Solved Direction based on player's direction

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

NightyNight

Member
Feb 21, 2017
20
0
0
20
I custom coded a custom enchant plugin and I have an enchantment that will dig in a 3x3 area where the player does. What I cannot figure out, however, is how I can test for which direction a player is facing in when they mine a block, then set the blocks in a 3x3 plane around that block to air. If this worked, I think this is what it would look like:
code_language.skript:
if lore of player's tool contains "&eExcavate I":
    if player is facing west:
        #set blocks
    if player is facing up:
        #set blocks
... and so on
and I could just set the blocks above, below, left, right, etc to air, but this only works one way.
can anyone help? thanks :emoji_slight_smile:
 
Last edited:
To get their direction it's "player's facing". So you would do:
code_language.skript:
if player's facing is west:
    #set blocks

However this won't tell you up or down so for that you need to look at "player's pitch". Ex:
code_language.skript:
if player's pitch is less than 0: 
    broadcast "player is looking up!"

Also, "player's facing" won't give you northeast, southwest, etc so if you need diagonals use "player's yaw". Ex:
code_language.skript:
if player's yaw is greater than 22.5:
    if player's yaw is less than 67.5:
        broadcast "player is looking northeast" #i think it's northeast I don't have MC so it might be southwest or soemthing
 
90 is down
[doublepost=1497471797,1497471744][/doublepost]To see what the different yaws and pitches are do f3 and it's there
[doublepost=1497471829][/doublepost]Looking straight is 0
 
Status
Not open for further replies.