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.
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?
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
• 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
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
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
I’m also confused 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
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
So i took a pause and completely forgot about positing but you are amazing for following my craziness and I dont have a solution but maybe I can explain it better
Goal: Player picks up a health pickup, which will slowly heal the player to a set number of health
Issue: When the health pickup is grabbed, the health will go over the amount set to heal (which is set in the health pickup actor)
I think what’s happening here is that the current health value gets incremented continuously on the timer’s every update, and the reason it’s not totally skyrocketing is because of that finterp node you got there which slows the process down. You’ll see that it increases the health to an even bigger number if you increase the finterp speed.
Now, you shouldn’t use the finterp node if you’re already using a timer. Instead, you should use a lerp node. Assuming the float track in your timer’s ratio is already 1:1, you can go ahead and plug that value into the alpha pin of a lerp (float) node. (it can also just be proportional and not 1:1 btw, you can adjust how much should the values be affected by each second to your liking) Then you can store the player’s health when it interacts with the healing item and plug that value into the A pin of the lerp node (make sure that value doesn’t get updated during this process). And finally, add the total amount of health that you want to be healed onto the health that the player had when it first interacted with the item and plug the result into the B pin of the lerp node. Now you can insert the final result to your player’s current health