First Time posting here however I have a Delay attached to a timer that begins and stops stamina regeneration once it is up to the value of the max stamina. The problem is that once it starts regenerating it keeps regenerating even another action takes place without resetting the delay if that makes sense. Any and all help is appreciated
How do I make the regeneration system turn off if a character performs another action within a certain time of the initial action
Just use the node clamp int. Connected it to your stamina. It has a min value and max value that you can set. So just plug in your max health to its max value and it’ll never go higher then that.
Not sure I completely understand. Are you using the timer to control the delay itself that happens before the Regen function is called? Or are you using the timer to repeatedly call the Regen function so that the stamina “fills up” over time?
Sorry day job. the event itself is used after an action takes place. I.E.: jumping the function is the actual regeneration. Basically whats happening is -Stamina x amount, trigger stam regen event, delay, execute stam regen. The problem is that the stamina doesn’t stop regening until stamina is = to max stamina even if another action takes place. Hope that clears that up.
See comment above. Also thanks for the responses
Sorry as to your question. The stamina is regenerating in a loop the delay is just for delaying that timer so the stamina regen doesnt happen as soon as an animation begins
Both screenshots are there if you click on the screenshot png’s it should make it full screen holding all the nodes in question
Sorry, it’s still not clear. Can you post a screenshot of the blueprint that shows how you’re setting up and using the delay and the loop timer?
I see two things that need to be fixed. The first - and probably most important - is that you should put a second “Clear Timer” node immediately after your “StamRegen” event node. You need to do this to ensure that any currently running regen timer is stopped. This is primarily what’s causing the behavior you’re seeing.
The second thing is a bit less critical and also trickier to fix. Using the delay node here is problematic because delays can’t be cancelled after they’re set in motion. That means that when action 1 starts delay 1, if an action 2 occurs before that delay is finished there’s no way to reset the system to say, “forget that first delay and wait a little longer to trigger the regen.” Instead delay 1 will complete at its normal time and trigger the regen prematurely relative to action 2. One way to fix this would be to replace the delay node with a second timer node that isn’t set to loop. That way you can cancel/reset both timers whenever the StamRegen event occurs.
Ok I’lll be sure to add a clear timer node and I’ll check out if a second timer helps. Otherwise possibly moving the delay into the function may help? I’ll give things a shot later tonight or tomorrow thanks for your input