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.

Game timer is not working

Discussion in 'Skript' started by Jonathan Cohen, Feb 17, 2021.

Thread Status:
Not open for further replies.
  1. Jonathan Cohen

    Joined:
    Jul 31, 2019
    Messages:
    23
    Likes Received:
    0
    1. Script Version: 2.2-dev36
    2. Script Author: Njol
    3. Minecraft Version: 1.8.8
    4. Full Code: https://pastebin.com/UtFpp5TH

    I am making a skywars minigame using skript and I'm now working on the timer. The first stage of the timer works normal but when the timer hits 0:00 and goes onto 1:59 the timer just freezes. the code I am talking about:


    if {sw.arena.%{_value}%.seconds} <= 1:
    if {sw.arena.%{_value}%.minutes} != 0:
    wait 1 second
    set {0.%{_value}%} to ""
    set {sw.arena.%{_value}%.seconds} to 60
    subtract 1 from {sw.arena.%{_value}%.minutes}
    else:

    wait 1 second
    subtract 1 from {sw.arena.%{_value}%.event.num}

    if {sw.arena.%{_value}%.event.num} = 3:
    set {0.%{_value}%} to ""
    set {sw.arena.%{_value}%.minutes} to 1
    set {sw.arena.%{_value}%.seconds} to 59
    loop blocks in radius 100 around {sw.arena.%{_value}%.center.loc}:
    if loop-block is a chest:
    clear loop-block's inventory
    loop (random integer between 10 and 20) times:
    set {_random} to random element out of {normalislandchests::*}
    set {_slot} to a random integer between 0 and 26
    add {_random} to slot {_slot} of loop-block's inventory
    wait 1 tick
    if loop-block is a trapped chest:
    clear loop-block's inventory
    loop (random integer between 5 and 12) times:
    set {_random} to random element out of {normalmidchests::*}
    set {_slot} to a random integer between 0 and 26
    add {_random} to slot {_slot} of loop-block's inventory
    wait 1 tick
    send {sw.arena.%{_value}%.players.alive::*} title "{@refill}" for 1 seconds
    play sound "block.chest.open" with volume 5 at player for {sw.arena.%{_value}%.players.alive::*}
    wait 60 seconds
    send {sw.arena.%{_value}%.players.alive::*} title "{@5minremaining}" for 1 second
     
    #1 Jonathan Cohen, Feb 17, 2021
    Last edited: Feb 17, 2021
  2. Kolombooo

    Kolombooo Member

    Joined:
    Dec 3, 2020
    Messages:
    42
    Likes Received:
    3
    Please post your code using the code text in the plus icon
     
Thread Status:
Not open for further replies.

Share This Page

Loading...