x

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"

Simple way to countdown from 100 during key press?

Hello,

I've been wrapping my head around timers, timelines, event tick delta seconds, etc. I still cannot seem to find a good solution for this. Essentially I have a meter, say with a value of 100, and whenever the player is pressing a key input, I want to decrease this meter by a certain amount every second. What is the optimal way to blueprint this?

I tried continually storing Event Tick Delta Seconds and when the key is pressed... somehow... decrementing for each second that elapses. But I just cannot seem to do this properly...

Any help is greatly appreciated... the example that would put me in the right direction would simply take a key press and as long as that key is pressed, decrease a float by one for every one second it is pressed until it gets to 0.

Thanks for any assistance.

Product Version: Not Selected
Tags:
more ▼

asked May 30 '14 at 08:19 AM in Blueprint Scripting

avatar image

kingkeoua
201 25 25 201

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

2 answers: sort voted first

This should work, There's probably many different ways you can do it. The number integer will lower by 1 every second that the enter button is pressed. You can abuse this by repeatedly pressing enter though, if this is not intended then you might want to move the delay to run before the set node so they can only move it one time per second which is what I did in the second example.

alt text alt text

blueprint.png (156.7 kB)
blouprint.png (116.2 kB)
more ▼

answered May 30 '14 at 09:08 AM

avatar image

mikesdav
51 4 5 9

avatar image 8-lines Jun 28 '14 at 11:07 PM

Worked like a charm for me. Coupling the delay with the boolean was a good call. Thanks!

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

Here's an example on how you an do this using Delta Time. alt text

Every Tick you multiply ChangeRate with Delta Seconds. This means the ChangeRate is a per second type of value (in my example the meter will change with 10 per second). After that you take the result and subtract from the Meter value. You may want to add functionality to reset the Meter and so on. Also you can simply set default values on Meter and ChangeRate, you don't need the BeginPlay node but it makes it easier to screenshot.

countdown.png (101.7 kB)
more ▼

answered May 30 '14 at 04:48 PM

avatar image

Dieselhead
1.1k 27 21 210

(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