How do i fix a line of code not working related to a timer-like mechanic?

How do i… fix this code related to an emotions system for a Raise-A type of game?


this is the current code. I don’t exactly know what is the issue, but the “change emotion add 1” script isn’t working
I’ll provide more details if needed

Welcome. You may want to use a timer instead of a wait.

https://wiki.gdevelop.io/gdevelop5/all-features/timers-and-time/#scene-timers

Also, wait only affects the events directly below it in the same event or subevents. So, currently the wait is doing nothing. All of the other events continue to run. It’s a bit misnamed. Also, waits should have conditions otherwise they just keep getting created and will expire in the same order as they are created.

You can read more here.
https://wiki.gdevelop.io/gdevelop5/all-features/timers-and-time/wait-action/#the-wait-x-seconds-action

1 Like

Oh, thank you very much for this recommendation, but as i mentioned before, the "change the global variable: emotion: add 1 doesnt work… also sorry for answering late

Here is one way to do it with a timer. Timers are normally started at the beginning unless you need to do it with some other conditions.

You need to add trigger once to condition cause right now it is constantly waiting 0.5sec

But then your 1st event will run only once
You would need add some condition to it

For example Button pressed → subtrract from emo timer