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.

Arena countdown teleport system

Discussion in 'Skript' started by SoMuchWessel, May 16, 2017.

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

    SoMuchWessel Active Member

    Joined:
    Apr 3, 2017
    Messages:
    147
    Likes Received:
    2
    Hey guys, Im working on a arena like Skript. Players click on a sign named Blue and Red. If they choose Blue, they will go into team blue. I also have a countdown system like this:
    Code (Skript):
    1. command /startsandbox:
    2.     trigger:
    3.         if {sandbox.countdown} is false:
    4.             set {sandbox.countdown} to true
    5.             loop all players:
    6.                 loop-player has permission "sandbox.chat":
    7.                     if {%loop-player-1%.team} = 1: #team blue
    8.                         send "&bEnough people are ready!" to loop-player
    9.                         wait 1 second
    10.                         send "&b5.." to loop-player
    11.                         wait 1 second
    12.                         send "&b4.." to loop-player
    13.                         wait 1 second
    14.                         send "&b3.." to loop-player
    15.                         wait 1 second
    16.                         send "&b2.." to loop-player
    17.                         wait 1 second
    18.                         send "&b1.." to loop-player
    19.                         wait 1 second
    20.                         make loop-player-1 execute command "/warp bsand"
    21.                         set {sandbox.game.started} to 1
    22.  
    23.                     else if {%loop-player-1%.team} = 2: #team red
    24.                         send "&bEnough people are ready!" to loop-player
    25.                         wait 1 second
    26.                         send "&b5.." to loop-player
    27.                         wait 1 second
    28.                         send "&b4.." to loop-player
    29.                         wait 1 second
    30.                         send "&b3.." to loop-player
    31.                         wait 1 second
    32.                         send "&b2.." to loop-player
    33.                         wait 1 second
    34.                         send "&b1.." to loop-player
    35.                         wait 1 second
    36.                         make loop-player-1 execute command "/warp rsand"
    37.                         set {sandbox.game.started} to 1
    But what now happens is that if you are with 2 people in the game, First one player gets the countdown and get teleported, and after that another one. But what i want is that everyone is teleported at the same time, everyone from the blue team and everyone from the red team. Can you guys help me out?
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Well, you may want to rewrite that system because it's really ineficient and wouldn't let you want you want to do. As it seems, you're a newbie at Skript so I'll leave some tricks here:

    • List variables are a lot better than single variables, instead of write:
    Code (Skript):
    1. set {sandbox.cooldown} to true
    it's better to do:
    Code (Skript):
    1. set {sandbox::cooldown} to true
    why? Because if the game finished you should delete those variables, with single variables you would do:
    Code (Skript):
    1. delete {sandbox.cooldown} and {sandbox.game.started}
    but with a list variables it's as simple as do:
    Code (Skript):
    1. delete {sandbox::*}
    other benefit from them is that you can iterate through them, which isn't possible with single variables. Basically, this:
    Code (Skript):
    1. loop {sandbox::*}:
    2.     send "%loop-value% - %loop-index%"
    3.  
    • Other thing I see is that you're doing the following:
      Code (Skript):
      1. set {%player%.team} to whatever
      Which is something you shouldn't do because, first of all, that's a horrible variable naming and even Skript throws a warning about that, and the another reason is that you could do it better with list variables, for example:
    Code (Skript):
    1. add player to {sandbox::team::red::*}
    and then do:
    Code (Skript):
    1. send "<light blue>Enough players are ready!" to {sandbox::team::red::*} and {sandbox::team::blue::*}
    2. loop 5 times:
    3.     send "<light blue>%6 - loop-num%..." to {sandbox::team::red::*} and {sandbox::team::blue::*}
    4.     wait 1 second
    5. teleport {sandbox::team::blue::*} to {sandbox::team::startLocation::red} #you would have to set these variables.
    6. teleport {sandbox::team::red::*} to {sandbox::team::startLocation::blue}
    7.  
    Now, regarding your issue, you should set two variables with the start location of every team as I said above and then teleport them to it.
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Thanks for your respond. Yes i am new at Skript and i know it is a bit inefficient, but i understand the single variables, so thats why i used them so much.
    I dont really understand list variables, all i do in my 600+ lines skript is setting variables to 0 or 1, or true or false.
    I think its going to be hard to kinda rewrite the whole thing to use list variables
    --- Double Post Merged, May 16, 2017, Original Post Date: May 16, 2017 ---
    Is there any way to do it with single variables?
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Send the full script in a here or in a PM if you want, I'll help you with the recode :emoji_thumbsup:
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Thanks! I will send it after im done with school today!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...