Download

Some Timer errors, please help me

hello dear developers, i have a kind of beginner question, but i couldn’t figure it out how to do it. I tried with some branches but it didn’t worked, so how can i do this?

So my game is about:

You have story levels: 60 second timer. if the timer runs out you died. at the end of the map you have to pick up one FOCUS STONE, and if you picked it up, you can have 5 more seconds in the open jungle

Open Jungle: 60 second timer by default. But if you have one focus stone it’s 65 seconds, and 2 focus stone 70 seconds 5sec/FOCUS STONE

I already did the timers, and you die at 60 s, but i couldn’t figure out the +5 second part

If you don’t understand the question, please add me on Skype:Simigla Roland (No profile picture, From hungary, 3 simigla roland, both of them are me.)

please anyone be kind and help me thanks!****

Don’t use timers for this, maybe they are updated by now but last time (version 4.3) when i tried them my app was crashing, and that never happened without timers.
I am not sure about cause (just my guessing) but when you close unreal, and time is active sometimes it will tick once more and that causes crashes.

Also my biggest reasons for not using timers are:

  • they use referencing by text name, it is ver y easy to lose track of all those timers later in project, and create some funny errors, that are not fun to debug.
  • they are immune to game pause and time slowdown, so useles unless your game never pauses

Instead of timers create your own event tick that uses “game seconds”. In some blueprint that is easily found and castable (like player controller) create event dispatcher, and call it every second (or 0.2 seconds which is optimal for most games). Then as parameter for that dispatcher send integer counter (don’t worry that counter will last for few thousands of years before it flips).

No you can assign some events to that dispatcher in your actors. And all they need to do is count and do something every 5th event or every 6th etc.For counting do simple modulo operation, and when result is zero it is time to act.

https://www.youtube.com/watch?v=12kQoBJKTqU well, i did it like this, maybe that is not causing errors , but okay then i will do it your way, but you know i’M still a beginner, so i don’t think i can make it on my own :frowning:

I use timelines everywhere where i need to have something changing over time, they are perfect for this type of stuff.

How are you currently triggering death at 60 seconds? You must be checking if your time integer is equal to 60, right? Just change that number you’re comparing it to. Have a max-time variable, and if you pick up a focus stone, add 5 to it. OR, you could subtract five from your current time.

Everyone in this thread is talking about a different thing, haha. Timers, Timelines, and counting up an int on tick are all specific different things. Personally I use timelines, they’re really intuitive and easy to use.