Variable only changes once, then never again

Hey guys, I need help with an issue please. I’m making a game
and this is what’s supposed to happen: every 6 seconds the timer “scene” will generate a random number from 1 to 20, which will be the variable RNG. then the game checks if the variable RNG is less or equal to the variable LEVEL, which is 15 in this case. if it is less, then the variable POSITION should add 1. the problem is, it works the very first time (if rng variable is less than level ofc) and then it just doesnt change when it happens again. it might after a few times, but I need it to always change when it should. this is driving me crazy and I cant finish my game without this, help will be so much appreciated.

Remove the trigger once and see if it works

What? There is nothing under the trigger once condition, this has no relevance.

@epicgamemerboy12 The problem is that you are resetting the timer every frame. Once the rng < level is fulfilled, timer will never reach 6 seconds again.

You need to remove the second reset timer action (below “position: add 1”).

2 Likes

You are constantly resetting your timer in your rng<level event.

edit: rng is going to be 30 at the start of the scene. If it changes to <=15 once, It will always be less than 15 (level at the start of the scene). Therefore the timer will always be reset every frame.

It does not matter that your “timer >6” event is above the rng event, because the rng event will be true forever after the first time the rng resets, where as the timer event won’t be.