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.

Solved Double loop

Discussion in 'Skript' started by Delano, Apr 29, 2018.

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

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    So I made this script:
    Code (Skript):
    1. every second:
    2.     loop all players:
    3.         if distance between loop-player-1 and {Fura.Spider.Cave.Boss.Encounter} <= 4:
    4.             if {Fura.Spider.Cave.Boss.Conversation.timer.%loop-player-1%} is false:
    5.                 set {Fura.Spider.Cave.Boss.Conversation.timer.%loop-player-1%} to true
    6. #------------------------------------------------------------------------------------------------------
    7.                 if {Fura.Spider.Cave.Boss.Spawn} is false:
    8.                     set {Fura.Spider.Cave.Boss.Spawn} to true
    9.                     spawn a spider at {Fura.Spider.Cave.Boss.Spawn.Location}
    10.                     wait 1 second
    11.                     loop all entities in radius 20 of loop-player-1:
    12.                         set {Boss.Name::%loop-entity-2%} to "Baeiira"
    13.                         set name of loop-entity-2 to "&7[&5Baeiira&7]"
    14.                         set loop-entity-2's max health to 100
    15.                         set loop-entity-2's health to 100
    16.                         apply slowness 2 to loop-entity-2 for 99 minutes
    17.                         exit loop
    18.                 if {Fura.Spider.Cave.Boss.Spawn} is true:
    19.                     stop
    20. #------------------------------------------------------------------------------------------------------
    21.                 apply slowness 20 to loop-player-1 for 10 seconds
    22.                 apply jump boost -20 to loop-player-1 for 10 seconds
    23.                 wait 1 second
    24.                 message "&7[&5Baeiira&7] &eI wonder..." to loop-player-1
    25.                 wait 3 seconds
    26.                 message "&7[&5Baeiira&7] &eWhy would anyone just walk into our den?" to loop-player-1
    27.                 wait 3 seconds
    28.                 message "&7[&5Baeiira&7] &e1 thing is for sure, we won't let this opportunity go away" to loop-player-1
    29.                 wait 3 seconds
    30.                 message "&7[&5Baeiira&7] &eWe got fresh meat my children!" to loop-player-1
    31.             if {Fura.Spider.Cave.Boss.Conversation.timer.%loop-player-1%} is true:
    32.                 stop
    33.  
    34. on death:
    35.     {Boss.Name::%entity%} is "Baeiira":
    36.         set {Fura.Spider.Cave.Boss.Spawn} to false
    37.  
    38. command /timer <text>:
    39.     trigger:
    40.         if arg-1 is "reset":
    41.             set {Fura.Spider.Cave.Boss.Conversation.timer.%player%} to false
    42.             message "&eThe timer has been reset!" to player
    43.         if arg-1 is "test":
    44.             set {Fura.Spider.Cave.Boss.Spawn} to false
    45.             message "&eDone!" to player
    At first when the lines between the #----- weren't there and loop-player-1 was loop-player everything worked fine.
    now with the lines between the #---- nothing works anymore and I have no clue what it is..

    don't mind the text btw, it's for rp purposes
     
  2. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    wym by nothing works, errors? are you aware that the stop on line 19 will stop the loop, is that intentional?
     
  3. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    ow .. I noticed at line 8 that it sets it instantly to true so at line 18 it stops
    now line 8 is on the end of the loop so the loop runs until the end.
    only problem is I get slowness 2 while the max health and health of the spider is set to 100..
    and the last section under the #--- isn't triggering
     
  4. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    if {Fura.Spider.Cave.Boss.Spawn} is true that part wont trigger since youre stopping
     
  5. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    it works now, thanks!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...