Author Topic:  Relative to player and orientation  (Read 583 times)

0 Members and 1 Guest are viewing this topic.

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Relative to player and orientation
« on: May 10, 2015, 07:08:24 PM »
So the other day I was bored and had nothing to do, so I decided I wanted to make a script with a seemingly useless command. In this case, it was IsDistance. Although kinda ghetto, I was able to make a script that would allow to track your movements and orientation with a block. I also used it to let you shoot a fireball based on your direction. Here's a video to show the relative to player:


Warning! Horrible video quality! Watch at your own risk.
Spoiler for Hidden Content:

Dryym

  • Supreme Member
  • *****
  • Posts: 4323
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Relative to player and orientation
« Reply #1 on: May 11, 2015, 11:09:32 AM »
Would you be able to post the script here? I couldn't read it in the video.

This is a really cool system though, If it's alright with you, I think i'd like to use it.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Relative to player and orientation
« Reply #2 on: May 11, 2015, 01:54:38 PM »
Would you be able to post the script here? I couldn't read it in the video.

This is a really cool system though, If it's alright with you, I think i'd like to use it.

The script is 200+ lines, but most of it is just repetitive segments of script with modified coordinates and conditionals. When I get home, I'll post a segment with a more in depth explanation

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Relative to player and orientation
« Reply #3 on: May 11, 2015, 03:24:58 PM »
Ok, explanation time...

The system works on 2 script blocks looping, one that is 3 blocks above you, the other is 8 blocks below you (these numbers can be modified by changing the y coordinates in all the the coordinates). The top one is written with segments like so:


If
IsDistance [rel:5,-4,0] [<] [4]
//  The first coordinate is detecting 4 blocks below the script block and 5 in the +x.   The second number set detects whether your are 4 blocks less than the first coordinate set.
IsDistance [rel:0,-5,0] [>] [1]
// This makes sure you are greater than 2 blocks or greater from the script block.
Then
SetPower [rel:0,-12,0] [on]
// This sets power to the 2nd script block that is below the first script block.
MoveBlock [rel:0,0,0] [rel:1,0,0]
// This moves the top script block towards you
MoveBlock [rel:0,-12,0] [rel:1,-12,0]
// This moves the below script block towards you.

The bottom script block is written like so:

SetPower [rel:0,0,0] [off]
Wait [125]
// Below we are powering and then powering off the possible coordinates that the top script block could be located
SetPower [rel:-1,12,0] [on]
SetPower [rel:-1,12,0] [off]
SetPower [rel:1,12,0] [on]
SetPower [rel:1,12,0] [off]
.... Ect

Dryym

  • Supreme Member
  • *****
  • Posts: 4323
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Relative to player and orientation
« Reply #4 on: May 11, 2015, 03:28:35 PM »
Ok, explanation time...

The system works on 2 script blocks looping, one that is 3 blocks above you, the other is 8 blocks below you (these numbers can be modified by changing the y coordinates in all the the coordinates). The top one is written with segments like so:


If
IsDistance [rel:5,-4,0] [<] [4]
//  The first coordinate is detecting 4 blocks below the script block and 5 in the +x.   The second number set detects whether your are 4 blocks less than the first coordinate set.
IsDistance [rel:0,-5,0] [>] [1]
// This makes sure you are greater than 2 blocks or greater from the script block.
Then
SetPower [rel:0,-12,0] [on]
// This sets power to the 2nd script block that is below the first script block.
MoveBlock [rel:0,0,0] [rel:1,0,0]
// This moves the top script block towards you
MoveBlock [rel:0,-12,0] [rel:1,-12,0]
// This moves the below script block towards you.

The bottom script block is written like so:

SetPower [rel:0,0,0] [off]
Wait [125]
// Below we are powering and then powering off the possible coordinates that the top script block could be located
SetPower [rel:-1,12,0] [on]
SetPower [rel:-1,12,0] [off]
SetPower [rel:1,12,0] [on]
SetPower [rel:1,12,0] [off]
.... Ect


I actually semi figured this out earlier, But i have 2 questions, How do you make it change elevation, And, Why not make the 2nd script block above the 1st?

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Relative to player and orientation
« Reply #5 on: May 11, 2015, 04:00:51 PM »

I actually semi figured this out earlier, But i have 2 questions, How do you make it change elevation, And, Why not make the 2nd script block above the 1st?

To change elevation, you have to fiddle with the relative coordinates. I'm not on my xbox right now, but it just takes some messing around to get the coords right. I put the blocks above so I had a visual representation of the blocks following. It can easily be hidden to a point where it's unseeable and it doesn't mess with the built map.

Dryym

  • Supreme Member
  • *****
  • Posts: 4323
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Relative to player and orientation
« Reply #6 on: May 11, 2015, 04:15:15 PM »
To change elevation, you have to fiddle with the relative coordinates. I'm not on my xbox right now, but it just takes some messing around to get the coords right. I put the blocks above so I had a visual representation of the blocks following. It can easily be hidden to a point where it's unseeable and it doesn't mess with the built map.

What i meant, Is why not put the loop block on top of the other one? I did this on my world, And it seemed to work fine. I have it following me, But it is still a bit buggy, But you've still got a really nice system going.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Relative to player and orientation
« Reply #7 on: May 11, 2015, 04:26:41 PM »
What i meant, Is why not put the loop block on top of the other one? I did this on my world, And it seemed to work fine. I have it following me, But it is still a bit buggy, But you've still got a really nice system going.

Oh, that's because my original setup was completely hidden. I changed it for demonstration purposes.

Dryym

  • Supreme Member
  • *****
  • Posts: 4323
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Relative to player and orientation
« Reply #8 on: May 11, 2015, 04:30:55 PM »
Oh, that's because my original setup was completely hidden. I changed it for demonstration purposes.

Ah, I'd recommend making it hidden in the air so it doesn't cut into underground bilds, Or make holes that would cause performance drops.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Relative to player and orientation
« Reply #9 on: May 11, 2015, 04:37:40 PM »
Ah, I'd recommend making it hidden in the air so it doesn't cut into underground bilds, Or make holes that would cause performance drops.

Yeah, like I said, demonstration purposes :P

MEDUSA

  • Supreme Member
  • *****
  • Posts: 2976
  • - Jaz
  • Awards Awarded to exemplary forum members 3 years on site+600 posts Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners 4 years on site+1000 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts 1 year on site+100 posts
    • View Profile
    • cluckinbellhappychicken
    • Awards
  • Xbox: Jaz the MAN 2
  • PSN: Jaz_the_MAN_2
  • Steam: Jaz the MAN 2
Re: Relative to player and orientation
« Reply #10 on: May 11, 2015, 05:11:07 PM »
I wanted to do something like this to add a sort of pet system to my world, only trouble is trying to not make the pet cut through walls so I scrapped the idea :P



I had to break up with Medusa. I just got sick of buying mice for her hair.
I should have ended it sooner, but you try looking into those eyes.