Solved Need help identifying the issue

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

zainmz

Member
Apr 29, 2017
22
1
0
25
I have come to skript after a few years and I am skripting again, so I might have forgetten how most things work. Anway here is my code
Code:
        else if arg 1 is "chase":
            if arg 2 is set:
                if world is "world":
                    set {_x%arg-2%} to x-coordinate of %arg-2%
                    set {_y%arg-2%} to y-coordinate of %arg-2%
                    set {_z%arg-2%} to z-coordinate of %arg-2%
                    add 20 to {_x%arg-2%}
                    while {searching_for_loc} is true:
                        set {_loc} to location at {_x%arg-2%},{_y%arg-2%},{_z%arg-2%}
                        set {_block} to block at {_loc}
                        if {_block} is air:
                            if the block above {_block} is air:
                                if the block below {_block} is not air:
                                    if the block below {_block} is not lava:
                                        set {teleport_loc} to {_loc}
                                        set {searching_for_loc} to false
                    wait a tick
                    teleport player to location at {_x%arg-2%},{_y%arg-2%},{_z%arg-2%} in world "world"

The aim is to teleport a a player to another player but 20 blocks away

errors:
Code:
>.... [15:12:15 ERROR]: Can't understand this expression: 'x-coordinate of %arg-2%' (test.sk, line 22: set {_x%arg-2%} to x-coordinate of %arg-2%')
>.... [15:12:15 ERROR]: Can't understand this expression: 'y-coordinate of %arg-2%' (test.sk, line 23: set {_y%arg-2%} to y-coordinate of %arg-2%')
>.... [15:12:15 ERROR]: Can't understand this expression: 'z-coordinate of %arg-2%' (test.sk, line 24: set {_z%arg-2%} to z-coordinate of %arg-2%')
>.... [15:12:15 ERROR]: {_loc} can only be set to one object, not more (test.sk, line 27: set {_loc} to location at {_x%arg-2%},{_y%arg-2%},{_z%arg-2%}')
>.... [15:12:15 ERROR]: Can't understand this condition/effect: teleport player to location at %{_x%arg-2%}%,%{_y%arg-2%}%,%{_z%arg-2%}% in world "world" (test.sk, line 36: teleport player to location at %{_x%arg-2%}%,%{_y%arg-2%}%,%{_z%arg-2%}% in world "world"')
 
try this
Code:
command /hejsa [<text>] [<player>]:
    trigger:
        if arg-1 is "chase":
            if arg-2 is set:
                if world is "world":
                    set {_x} to x-coordinate of arg-2
                    set {_y} to y-coordinate of arg-2
                    set {_z} to z-coordinate of arg-2
                    add 20 to {_x}
                    while {searching_for_loc} is true:
                        set {_loc} to "%{_x}% %{_y}% %{_z}%"
                        set {_block} to block at {_loc}
                        if {_block} is air:
                            if the block above {_block} is air:
                                if the block below {_block} is not air:
                                    if the block below {_block} is not lava:
                                        set {teleport_loc} to {_loc}
                                        set {searching_for_loc} to false
                    wait a tick
                    teleport player to location at ({_x}, {_y}, {_z}) in world "world"
 
  • Like
Reactions: zainmz
Thank you so much, I didnt know we have to set the coordinates as values instead of variables.
 
Status
Not open for further replies.