Solved How to set loop to repeat until variable changed

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

Jairo Echevarria

New Member
Mar 28, 2021
7
0
1
18
So am working on this code that would basically spawn items / shulkers every so often the dragon egg is placed

on place of dragon egg:
set artificial intelligence of shulker to false
send "started"
set {_status} to "on"
if {_status} is "on":
if player is in "world_the_end":
wait 1 seconds
chance of 80%:
drop 1 End Stone
chance of 80%:
drop 1 Chorus Plant
wait 1 seconds
chance of 50%:
spawn 1 shulker

on mine of dragon egg:
set {_status} to "off"
if {_status} is "off":
if player is in "world_the_end":
send "Stopped"

So I want {_status} to turn off and on the loop so that it would continue the loop until the status would change to off, in this case when the dragon egg is mined and on when placed. I would appreciate if someone could help me out with this
 
This is what I call the literal reason a while loop exists. Also, local variables don't pass through conditions, and please put your code into a code block next time (click on the + symbol above the text box when typing, then "Code").

Pseudo-code:

Code:
on place of dragon egg:
  while event-block is a dragon egg:
    do whatever
    wait 1 tick
 
  • Like
Reactions: Jairo Echevarria
Status
Not open for further replies.