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"

Help With Health/Power Regen Function ?

So I have a power system in the game that allows the user to see in the dark, and I have attached a decay so that the power drains over the course of it being on and if the value reaches 0 the player dies and the level restarts.

I now want to have the power value regen when the power function is off, thus allows the user to use it and mantain it

Max power is set to 100 FYI

Heres what I have so far any help you can provide would be great, still kind of new to unreal engine 4 scripting

alt text

alt text

Product Version: UE 4.9
Tags:
powersystem.png (407.1 kB)
powersystem1.png (234.5 kB)
more ▼

asked Jan 01 '16 at 09:53 PM in Blueprint Scripting

avatar image

Jamiex304
41 23 15 21

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

2 answers: sort voted first

Found a way to do it

here's how

alt text

regen.png (135.8 kB)
more ▼

answered Jan 02 '16 at 01:49 AM

avatar image

Jamiex304
41 23 15 21

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

Convert your power value to a float. On the first branch of your tick event, in the false exec output, add the delta time to your power. That will regen 1 per second. If you want it faster or slower, multiply delta time by something.

 Also change the == 0 to <= 0.

more ▼

answered Jan 01 '16 at 10:00 PM

avatar image

TTaM
1.7k 79 28 81

avatar image Jamiex304 Jan 01 '16 at 10:33 PM

can you show me how that would look in a blue print ? if its not to much to ask ?

avatar image TTaM Jan 01 '16 at 10:38 PM
avatar image Jamiex304 Jan 02 '16 at 12:58 AM

Didnt Work also my values are ints not floats

avatar image TTaM Jan 02 '16 at 01:41 AM

Convert your power value to a float.

avatar image Jamiex304 Jan 02 '16 at 01:48 AM

Was able to figure it out on my own seeing ur example helped a bit, so thanks I have post my solution

(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