Change yaw/facing of entity

  • 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.

lions788

New Member
Sep 5, 2019
5
0
1
Essentially, my code is spawning an armor stand at a location with the helmet of an item, and I am wanting to change the facing/yaw of {_e} when the item is magenta glazed terracotta block, but the yaw of {_e} just wont change


This is where the function is called, it will spawn an armor stand where the player is looking, and a weird thing I have found, is if the player is looking at a placed magenta glazed terracotta block, the yaw will be changed....

Example: if the player is looking at a westward magenta glazed terracotta block, the yaw will be 90..
Code:
on player's held item change:
    if {convery::%player%} is set:
        if player's held item is magenta glazed terracotta block:
            while player's held item is magenta glazed terracotta block:
                wait 0.3 seconds
                loop {holo::%player%::*}:
                    kill {holo::%player%::%loop-index%} parsed as entity
                set {_originspawn} to targeted block's location
                set {_spawnloc1} to {_originspawn}
                remove 0.6 from y-coordinate of {_spawnloc1}
                spawnStand(({_spawnloc1}), magenta glazed terracotta block, player)
            loop {holo::%player%::*}:
                kill {holo::%player%::%loop-index%} parsed as entity


Code:
function spawnStand(sp: location, h: item, p: player):
    spawn armor stand at {_sp}
    set {_e} to last spawned entity
    set helmet of {_e} to {_h}
    if {_h} is magenta glazed terracotta block:
        set yaw of {_e} to 180
        send yaw of {_e} to {_p}
    add "{Invulnerable:1b,NoGravity:1b,Invisible:1,NoBasePlate:1,DisabledSlots:2039583}" to NBT of {_e}
    add {_e}'s uuid to {holo::%{_p}%::*}
 

Attachments

  • on.PNG
    on.PNG
    909.5 KB · Views: 76
  • off.PNG
    off.PNG
    483.5 KB · Views: 75
Status
Not open for further replies.