Timeline to slowly heal player

Hello amazing people!

So my idea is the player picks up a health bar and slowly gains that set amount of health over x time.

My idea was to use a timeline, but IDK how to have the health variable apply to the timeline, like I understand the time it would take variable but I want to also input the amount of health and am somewhat new to timelines

I would share code but its kind of non existant after trying a few times haha.

this is in blueprintz
thank you!

I imagine (could be absolutely wrong here!) that you add a float track to your timeline, then from Update in the event graph, you would get your Health variable, add to it the track variable Health and then set health?

something like this:

So i wanted the amount of damage taken to be a variable to make it dynamoc and not hard coded, would I just set that with that variable? or how would I do that

The loop:

Player picks up healt
that object would have a variable saying how much health to restore
the player health would restore to that amount but over time

I want to affect that float value through the timeline to make it smoother than a timer function

does that make sense? im bad at explaining

• You can put tags on your different objects and check that to determine the total value of the heal it contains, or randomize it

• You can create an actor component blueprint and create a function inside it that will do the healing. Add an input pin to the function, drag that input pin and plug it in the target pin of a finterp node. You can adjust the interp speed to your liking. Then set the result to your health variable which will exist in that actor component blueprint

• Head back to your character blueprint and add that actor component to your character blueprint. Then get the heal value and plug it into the input pin of your heal function

1 Like

So this is where im at

I have a timeline thats started when an interface function is called

it works currently but I want it to take a variable and slowly move up to that value
(overlap with object starts timeline to move health up to x value)

I am very confused so im sorry, I somewhat understand what your saying but I can have pictures now

I know there has to be a way to have it act more dynamically, so I can set the value o the function and thats the exact amount of health adding to it



I think I understand what you mean.

What you can do is set the Total to Heal / 100 and set that as your Play Rate, set your timeline to 1 second and the timeline will play at the total heal as a percentage, which will change based on the items heal value

As for the healing item, you just need a float variable on it for healing, from OnComponentBeginOverlap you can call your event (you probably need to cast to your character from OtherActor) and plug the heal variable into Total to heal

I hope that helps, and makes sense… and works! Or at least gets you on track for something to work :slight_smile:

I’m also confused :rofl: since you replied to me but aren’t talking about the stuff I mentioned (maybe it has something to do with mobile sorry if I misunderstood) but may I ask did you try my suggestion?

Do you refer to me? If so, I could send some screenshots when I get on my PC

You can use the finterp node :innocent:

Yeah like I said earlier, you can have a heal function and plug a dynamic variable to it’s input pin. There are many ways to make it so, if you have a set scene you can just add tags to them, if you want surprises you can randomize the total amount of value that will slowly be healed in a range, or randomize it between set numbers :blush: