infinite loop help

Started by cqtz.the.shade.main on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
infinite loop help

im trying to make a procedure that:
-repeats infinitely
-every 30 seconds checks if my global variable is not 5, if it is, it executes no other scripts
-if it isnt, it raises the value of the variable by 1.

basically every 30 seconds 1 gets added to a global variable until its 5.
everything ive tried ends with 1 thing: the game "freezes" (no chat messages sending and stuff)
how the hell do i make it work?

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Stop using "wait x ticks…
Tue, 03/17/2026 - 20:41

Stop using "wait x ticks then do on server-side"

Instead create a second variable.

Run a procedure from global trigger world tick update increase the second variable by 1, and when it reaches 600, do all the stuff with your main variable, then reset the second variable to 0.

A note is that sometimes the world tick update global trigger acts a little weird, so if you are using a player-based primary variable, I would recommend doing this from player tick update instead and have the second variable be player-based. But if the first one is world based, keep the second one world based as well and maybe try experimenting with the number 600 to see what works best. Or maybe whatever was causing world tick update to act weird has been fixed and 600 will work well.