Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

(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 alt text 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. alt text 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. alt text 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!

Product Version: UE 4.8
more ▼

asked Sep 04 '15 at 12:55 PM in Blueprint Scripting

avatar image

1 1 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Sep 04 '15 at 03:44 PM

avatar image

1.8k 69 28 114

avatar image Halavanhelev Sep 04 '15 at 05:16 PM

The purpose of ForEachLoopForDelay (which is a custom loop) is to go through all the actor components and set them from hidden to not hidden one by one with certain time interval. So it doesn't actually have anything to do with the timer setup. It was just necessity to get delay to function inside the loop body.

The plan is not to have player keep certain button pressed before activating the spell but to have one keep the button pressed at the very same time as the spell goes on. If released, the spell should abrupt.

I want the timer to run at the same time as the spell is being cast - no matter how long the spell or what kind of spell. That is why I can't implement SpellTimer inside the loop but it must be outside of it.

If I can't use Timer setup like this - do you know if there is any other way of achieving the result with the idea I mentioned earlier? I'm wondering if I should check out how to make custom counters to replace Timer-nodes....

avatar image Halavanhelev Sep 04 '15 at 05:50 PM

Edit Figured just out how to go around it. The following thread was most helpful. https://answers.unrealengine.com/questions/40831/how-to-count-the-seconds-that-we-keep-a-key-presse.html

Thank you erinacea for pointing out my mistake with the timer node!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question