Started by
AceleracerX
on
Topic category: Help with MCreator software
so i'm making a boss that is supposed to summon lightning every 4 seconds and explode with that same delay, but instead after waiting 4 seconds the boss just repeatedly summons all of his attacks every tick (and also kills himself lmao), can someone tell me what's going on?
The problem is that this procedure is still running every single game tick. That means every twentieth of a second, it tells the boss to wait four seconds, and then spawn lightning. Which means the boss waits four seconds, and then spawns a constant stream of lightning.
Instead, you need some sort of variable, (either a custom NBT number tag, or if there's only ever going to be one boss, a global number variable), that keeps track of the cooldown between the boss's attacks, and decreases by one every tick it's greater than zero. That way, you can check if the cooldown has expired before attacking, and reset the cooldown every time the boss attacks so it doesn't spam.