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"

Reset countdown timer and apply times two damage every time countdown timer resets

What I am looking to do is every time my countdown timer which is set at 30, reaches zero, I want it to reset back to 30. Not only that but when it reaches 0, I want the player to receive damage and every time it resets and drops to 0 it will again apply damage and keep looping like that. Also every time it applies damage it will apply times 2 damage.

I will give an example.

My countdown clock is set to 30. When it reaches 30 I want to apply 5 damage. When the countdown timer resets and drops back down to 0 i want to apply 5X2 damage which equals 10. The next time it resets and drops to 0 I now want to apply 10x2 damage which equals 20 and just keep going like that higher and higher.

I have a screenshot but i know its completely wrong. It does what I want,but just one time. alt text

I really would appreciate any help. Thanks in advance.

Product Version: UE 4.16
more ▼

asked Aug 13 '17 at 12:55 AM in Blueprint Scripting

avatar image

1 1 5 5

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

2 answers: sort voted first

This is what I came up with. Its simple, but it seems to work perfectly.

alt text

more ▼

answered Aug 21 '17 at 04:04 PM

avatar image

1 1 5 5

avatar image Noose. Aug 21 '17 at 09:30 PM

Why did I happen to get a down vote for this?

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

I'd suggest you the SetTimerByFunctionName node. It creates a timer, and you can make it loop.

alt text

You just have to create a function, then call this node once (only once) by specifying the function name and the timer.

For the "double the damage each time" part, I would do a class variable to store the number of calls of that function, then multiply your damage by this number.

Also, I saw you put a delay, then decremented your variable. You should have directly substracted "DeltaSeconds" from your variable, since "DeltaSeconds" is the time since the last frame.
So basically, do this :
"Each frame, substract DeltaSeconds"
Instead of this :
"Each second, substract one second"
Anyway, with the SetTimerByFunctionName, you don't have to use this kind of behaviour :)

Hope it helped!

more ▼

answered Aug 13 '17 at 03:41 AM

avatar image

121 4 9 11

(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