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"

Why is my timer not firing every .5 Second?


My blueprint for continuous damage for every half second that my character stands on spikes is not functioning correctly. I only take damage when I initially stand on the spikes and unreal never calls for a second check on whether I should take damage or not. Do I have the right idea here? How can I fix this?

I originally a function plugged in the settimer node for a value of .5, but it didn't seem to be adding anything so I deleted it.

Thanks a ton guys.

alt text

Product Version: UE 4.8
timer.png (200.7 kB)
more ▼

asked Jul 13 '15 at 05:48 AM in Blueprint Scripting

avatar image

5 3 5 8

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You should read up on how to use timers. What you did is starting a timer named "" (thats an empty string) and then continued with reducing the health by 0.5 and then the event is finished. Timer is an asynchronous task and does not work like Loop (think about it, it makes sense).

What you should do: Create a function, which deals damage and name it, eg "ApplyDamage" put the name (ApplyDamage) into the function name of Set Timer.

From then on, ApplyDamage is called every 0.5 To end the timer, you call "Set Timer" with loop=false (but this actually calls the timer once more) or you cancel it with "Clear Timer".

more ▼

answered Jul 14 '15 at 08:57 AM

avatar image

859 23 9 40

avatar image Enlo Jul 14 '15 at 09:00 AM

PS: Your actor can potentially have multiple overlap events in a short time and therefore get more damage than every 0.5 seconds. The reason of this is, that if SetTimer is called on an already active Timer, it's "cooldown" is reset and it runs immediately.

To prevent this, insert a branch which uses "Is Timer Active" to check if the timer already runs (then you don't need to start it again)

avatar image kirby.c Jul 14 '15 at 05:14 PM

I'll try this when I start up Unreal later today, thanks so much Enlo.

(comments are locked)
10|2000 characters needed characters left

I ended up taking out the timer entirely as I couldn't get it to work while looping back to the start of my damage system with a variable of is Elisa overlaping with spikes and setting up a branch. If the variable of spike overlap is true then run the damage system again. If false do nothing, not what I was trying to do but it works like a charm.

more ▼

answered Jul 14 '15 at 03:02 AM

avatar image

5 3 5 8

(comments are locked)
10|2000 characters needed characters left
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