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.

Compass tracker skript

Discussion in 'Skript' started by rilasiggs, Aug 10, 2020.

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

    rilasiggs Member

    Joined:
    Aug 10, 2020
    Messages:
    4
    Likes Received:
    0
    So I am making a skript that tracks a player when the compass is right clicked, and I am having trouble with the conditional in the skript.
    Code (Text):
    1. command /track <player>:                                      
    2.   description: Use this command to track a player by right clicking with a compass
    3.   trigger:                                              
    4.     set {target player} to  arg 1                              
    5.     send "<yellow>You are tracking %{target player}%"              
    6.     give compass to the player
    7.  
    8. on rightclick with a compass:
    9.   if player and {targetplayer} is in world "world":                          
    10.     set {track location} to location of {target player}                          
    11.     set player's compass target to {track location}
    12.     send "<light green>Compass is now pointing to %{target player}%"
    13.   else if player is in world "world":
    14.     send "<light red>%{target player}%<light red> is not in the Overworld"
    15.   else:
    16.     send "<light red>The compass does not work in this dimension"
    When I test the skirpt on my server, the game says *player name* is not in the Overworld, so clearly the first conditional is not including all the scenarios I want it to. When the compass is used in the other dimensions, the correct text appears, therefore (if I'm correct) the problem is line 9:
    "if player and {targetplayer} is in world "world"
    (this line is meant to check if both the tracked player and the player with the compass are in the overworld)
    Any suggestions on what to change?
     
  2. Deku

    Deku Member

    Joined:
    Jul 12, 2020
    Messages:
    36
    Likes Received:
    0
    try with this:
    Code (Text):
    1. command /track <player>:                                    
    2.   description: Use this command to track a player by right clicking with a compass
    3.   trigger:                                            
    4.     set {target::%arg 1%::*} to arg 1                            
    5.     send "<yellow>You are tracking %{target::%arg 1%::*}%"            
    6.     give compass to the player
    7.  
    8. on rightclick with a compass:
    9.   if player and {target::%arg 1%::*} is in world "world":                        
    10.     set {track.location} to location of {target::%arg 1%::*}                        
    11.     set player's compass target to {track.location}
    12.     send "<light green>Compass is now pointing to %{target::%arg 1%::*}%"
    13.   else if {target::%arg 1%::*} is in world "world":
    14.     send "<light red>%{target::%arg 1%::*}%<light red> is not in the Overworld"
    15.   else:
    16.     send "<light red>The compass does not work in this dimension."
     
  3. rilasiggs

    rilasiggs Member

    Joined:
    Aug 10, 2020
    Messages:
    4
    Likes Received:
    0
    Sorry for the late reply. Here is the error message I got. error.png
    --- Double Post Merged, Aug 14, 2020, Original Post Date: Aug 14, 2020 ---
    Never mind, I had a typo in my original code, line 9 had a typo in the variable.
     
  4. if the issue is resolved, you should add the resolved tagg to this thread.
     
  5. rilasiggs

    rilasiggs Member

    Joined:
    Aug 10, 2020
    Messages:
    4
    Likes Received:
    0
    Sorry, I'm new to the forums, how do I do that?
     
Thread Status:
Not open for further replies.

Share This Page

Loading...