(Solved) Why does my timer appear inactive?
I'm having a problem with the timer I've implemented in my blueprint system.
My plan is to create a spell that only finishes as long as the player keeps pressing the button until the spell blueprint has done all it's functionality. If the button would be released before that, the timer would reset and the player should start over.
This is basically what happens in my Character Blueprint I'm calling the function SpellTimer as a result of player input.
That function's purpose is to activate or clear the timer based on if the key is pressed or not. The SpellInvocationTime you see as a variable is set to 5 seconds. Okay... Now my plan is to spawn the ParticleSystem Actor which really is the spell the character is casting.
At the very beginning of every loop I'm commanding a check to see if the timer I activate in Character blueprint or not. As I mentioned earlier, If the key is released the spell cancels and if not it will continue. This is the place where the problems appear. If I completely ignore the IsTimerActive -check, the loop works fine and I get the result I want... Without the key holding effect.
As I have debugged it slightly by myself it seems that the IsTimerActive-value is constantly False which results to skipping the loop at the first step.
Also the other thing I noticed while debugging it is that if I GetTimerElapsedTime it shows me value of -1 before ending the loop.
I'm really out of ideas as to where to look for a solution to get the timer be active and as a result cause the spell work as I want.
I appreciate any help, thank you in beforehand!
You've forgotten to tell your Timer nodes which function should be invoked or cleared. Currently the SetTimer/ClearTimer nodes' Function Name property is empty. Judging by your IsTimerActive check you'll want to enter SpellTimer there. Note that SpellTimer needs to actually exist as a function in the character.
I don't understand the purpose of the ForEachLoopForDelay node, though. Maybe you use it for something else (UI or particle effects, maybe), but if it's just for keeping track of the timer the other nodes should be enough. When the player starts pressing the button, the timer is started. When the player releases the button, the timer is cancelled. And when the player has continuously been pressing the button for Spell Invocation Time seconds, the SpellTimer function is called, so you can trigger your actual spell effects there.
answered Sep 04 '15 at 03:44 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here