Set npc's yaw problems

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

TPGamesNL

Staff member
Moderator
Supporter
Addon Developer
Dev Programme
Jan 20, 2018
1,501
108
63
21
Skript Version: 2.2-dev29
Skript Author: Bensku
Minecraft Version: 1.12
---
Full Code:
code_language.skript:
command /npc2:
    trigger:
        set {_n} to a npc named "test" and entity type "PLAYER"
        spawn npc {_n} at location of player
        loop 50 times:
            set yaw of {_n} to yaw of player
            set pitch of {_n} to pitch of player
            wait 0.1 second
        message "done"

Errors on Reload:
none

Other Useful Info:
I am trying to change a npc's yaw and pitch, but whatever I try, it doesn't work.

Addons using (including versions):
Skellett (1.9.6b), SkQuery (3.21.4), WildSkript (1.9), skRayFall (1.9.10)

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it?
I tried using
code_language.skript:
set yaw of entity of npc {_n} to yaw of player
instead of
code_language.skript:
set yaw of {_n} to yaw of player
 
I tried it with teleport like this:
code_language.skript:
command /npc2:
    trigger:
        set {_n} to a npc named "test" and entity type "PLAYER"
        spawn npc {_n} at location of player
        loop 50 times:
            set {_l} to location of entity of npc {_n}
            set yaw of {_l} to yaw of player
            set pitch of {_l} to pitch of player
            teleport npc {_n} to {_l}
            wait 0.1 second
        message "done"
but then it only turned the body, not the head.
 
Might be an issue with Citizens, try playing with the values and see if it changes with a specific pitch/yaw.

You can also try teleporting the entity from the npc instead.
 
I tried a lot of values, also teleported the entity of the npc and even updated Citizens to the latest version, but it still isn't working. Should I try reporting it to Citizens?
 
The vanilla command does turn the npc's head, but I found the problem when I was making a script that teleports the npc a lot, and I don't want to spam the console. And also, it only changed the yaw, and not the pitch for some reason.
 
Status
Not open for further replies.