1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Set pitch and yaw

Discussion in 'Skript' started by vitusverden, Aug 28, 2018.

Thread Status:
Not open for further replies.
  1. vitusverden

    vitusverden Active Member

    Joined:
    Aug 16, 2017
    Messages:
    50
    Likes Received:
    2
    Have you tried searching the docs? Yes
    Have you tried searching the forums? Yes

    So, I have tried searching the forums, and docs, but it did not work the things i found.

    I am trying to set the players pitch and yaw, but i cant figure out how to do it.

     
  2. Best Answer:
    Post #5 by qKing12, Aug 29, 2018
  3. qKing12

    qKing12 Member

    Joined:
    Aug 14, 2018
    Messages:
    24
    Likes Received:
    1
    Code (Skript):
    1.  
    2.         set {_x} to x-coordinate of player
    3.         set {_y} to y-coordinate of player
    4.         set {_z} to z-coordinate of player
    5.         set {_world} to world of player
    6.         set {_yaw} to value
    7.         set {_pitch} to value
    8.         teleport player to location({_x}, {_y}, {_z}, {_world}, {_yaw}, {_pitch})
    9.  
    Maybe this?
     
  4. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Setting pitch/yaw directly does only work via NBT editing. Otherwise you'll have to use the methode from qKing above, where you teleport the entity to a location with a new pitch and/or yaw
     
  5. vitusverden

    vitusverden Active Member

    Joined:
    Aug 16, 2017
    Messages:
    50
    Likes Received:
    2

    Yeah, I know that I need to teleport - and I can get pitch to work. It is only yaw that does not work.
    --- Double Post Merged, Aug 29, 2018, Original Post Date: Aug 29, 2018 ---
    I have tried, did not work :emoji_frowning: It didn't send any errors, but it did not work

    Code:
    Code (Skript):
    1.  
    2. command /ce [<text>] [<text>] [<integer>]:
    3.     trigger:
    4.         if arg 1 is not set:
    5.             send "{@prefix} &c/ce one (C, CPRE, B, BPRE, A, APRE)&a- Laver en celle"
    6.         else if arg 1 is "one":
    7.             send "Stå stille, laver en celle"
    8.         else if arg 1 is "oneauto":
    9.             set {_x} to x-coordinate of player
    10.             set {_y} to y-coordinate of player
    11.             set {_z} to z-coordinate of player
    12.             set {_world} to world of player
    13.             #set {_yaw} to value
    14.             set {_pitch} to 0
    15.            
    16.             #set {_tploc} to player's location
    17.             #set {_tploc}'s pitch to 0
    18.             #change pitch of {_tploc} to 0
    19.             if player's facing is south:
    20.                 set {_yaw} to 0
    21.             if player's facing is west:
    22.                 set {_yaw} to 90
    23.             if player's facing is north:
    24.                 set {_yaw} to 180
    25.             if player's facing is east:
    26.                 set {_yaw} to -90
    27.             #teleport player to {_tploc}
    28.             teleport player to location({_x}, {_y}, {_z}, {_world}, {_yaw}, {_pitch})
    29.             send "%player's facing%"
    30.             send "%player's yaw%"
    31.             send "%{_tploc}'s pitch%"
     
  6. qKing12

    qKing12 Member

    Joined:
    Aug 14, 2018
    Messages:
    24
    Likes Received:
    1
    I tested your command and, don't know why, it does not work with pitch 0, set it to 1 and it will work
     
    • Agree Agree x 1
    • Informative Informative x 1
  7. vitusverden

    vitusverden Active Member

    Joined:
    Aug 16, 2017
    Messages:
    50
    Likes Received:
    2
    It worked :emoji_slight_smile: Thanks!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...