YAW & PITCH doesn't work

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

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
The problem is this: I have a variable set to the location of a loop-entity, and then, I set the yaw of the variable to a number and the pitch of the variable also to a number but the error message says that the ladder is not a number. If I didn't explain well, let's hope my code helps! Thanks

CODE:
code_language.skript:
command /villagerlocation:
    permission: villager.location
    trigger:
        loop all entities in radius of 3 around player's location:
            if loop-entity is a villager:
                set {villager1} to loop-entity       
                set yaw of {villager1.location} to 0
                set pitch of {villager1.location} to 0
                set {villager1.location} to location of loop-entity

every 1 tick in "world":
        teleport {villager1} to {villagr1.location}

ERROR:
code_language.skript:
[17:48:34 ERROR]: pitch of %player% can't be set to 0 because the latter is not a number (scripts.sk, line 20: set pitch of {villager1.location} to 0')
[doublepost=1503169120,1503103912][/doublepost]That error above is the same error it shows with the yaw just without the pitch but with yaw.
Bump
 
Wait, so what you guys are saying is that I should change 0 to 0.0? The thing is, I have tried before, setting the yaw to -0.2 and the pitch to 0.4 and it said the same error. Am I writing it wrong? Placing it in the wrong section of the code? I tried the same format with player instead of the loop-entity's location and it didn't make a difference, just in case if someone was going to ask me to try setting it to the player's location. Thanks :emoji_slight_smile:
[doublepost=1503179180,1503175043][/doublepost]Also, for the thing I want, I am trying to make the villager stay in one spot. If it is possible, is there any ways that you can make the villager not be able to move his head? What I did is I did the on entity teleport: then canceling the event if the entity is a villager. So, now, when the villager moves on it's own will, it won't, but when a player pushes it, it moves, which is why I created this which is shown on the top:
code_language.skript:
every 1 tick in "world":
        teleport {villager1} to {villagr1.location}

So, this way is not efficient as I have to run a command and blah blah blah. Is there any ways that I can check if his yaw and pitch changes so if it does move, it checks that? How would I do that because if the YAW and PITCH coordinates are not included in the on entity teleport event, then how would I check it? Thanks for the help. Also, if someone could help me out with the current question that still hasn't been answered about the YAW and PITCH not working, that would be great so that I can use it with future skripts. Thanks a ton! :emoji_slight_smile:
 
Thanks for the reply man. I have tried that earlier and it didn't seam to work. Thanks for the suggestion though, man. I appreciate it :emoji_slight_smile:
 
Status
Not open for further replies.