how to stop daamage drain via a pickup?

I have set up a blueprint where if I shoot another character, it applies 25 damage, and then on top of that it sets off sort of a “bleed out” thing, where the charachter that got shot, looses health overtime. Here is how it looks:

Now I want the character that got shot to be able to pickup a bandaid, that will stop the bleeding but not regenerate any health. Any advice on how to go about that? =) Ive only found tutorials on health-regeneration and I dont know if I can use the same approach.

Here is a picture of how the character that gets shot blueprint:

Bleed ?
-set timer by function name, for example “bleed”
Set time for example 1 and check “loop” to true
In event “bleed” apply damage to actor, only 1 node, no more needed.

On pickup pills or whatever -> clear timer by function name “bleed”

with “bleed” i mean that im trying to make the character be able to bleed out to death. i dont have function for that to happen, i tried to, but couldnt make a “delay” in the construction graph.

Delays are not meant for the ConstructionScript is this runs when the Actors is spawned/created/constructed.
You do what “Name368” told you in the EventGraph of your player.

“SetTimer” gives you a “TimerHandle” that references the Timer you started.
When the Player gets shot, you use the TimerHandle to check if the Timer is already running. If not, you start it and set it to loop.
The Seconds input is how often you want to have the Timer call your bound event (you need a CustomEvent that you bind by using the red square input
or, if you use “SetTimerByFunctionName” by just entering the name of the event).
If your player picks up the bandage you simply check if the timer is running and if yes you clear it.

That’s it. In the bound event you would go and deal damage.

PS: Why so many TRUE condition branches in your screenshots? They make 0 sense. If you want to make your Graph cleaner then just use “Reroute nodes”.

thanks. ill look into this.

i suppose youre refering to the one branch in the “If not headshot” comment. i forgot to delete that one, i had it there earlier because i had a condition that if it wasnt a headshot, and if the shot hit at a specific bone, then i wanted certain damage. so i had to have a branch there. i then decided not to have that idea in the game yet for testing purposes. i wanted to see if it registered at all if i shot the character in any other part than the head and not just 1 bone.

yeah, but he wrote “timer by function” and theres a box there where im supposed to write name of the function and i dont have a function for when the player looses health.

I mean these two. They are unnecessary.

https://puu.sh/ud6hu/76a54ec98f.png

Then create one? Call it “DealDamageOverTime”, without any inputs and use that name.
In this function/event, you simply reduce the CurrentHealth by what ever number you wish.
The Timer itself can be set to something lower than 1 second, but then you have to downscale the damage you deal in that function too,
otherwise you deal too much damage :P.

Setting it to tick every second sounds fine to me though. How much damage you want to deal in what amount of time is up to you in the end.

oh, no i dont think the are unneccesary. one of them (the first one) is supposed to reduce the players max-health with 25 everytime he gets shot. the other one applies 0,5 damage to his maxhealth overtime repeatedly. its 2 different types of damage. i think that if i removed 1 of those branches and combine the whole thing, it would remove 25 damage over time and the character would die way too fast. maybe i should have named the comment “impact damage” in the first comment, and then in the other one “post-damage” or “bloodloss”.

makes sense? or is there still a better way to do it?

Both branch nodes are pretty useless. You can freely remove them.

Buddy, these two branches are set to true. You don’t have any condition on them.
They are ALWAYS true. You can just remove them.

alright, removed them. i think i might need at least one of them later tho cus i will have separate bones that apply different damages? but ill worry about that later.

anyway. i made a custom event in the firstpersoncharachters event graph. i called it “bleed”. looks like this now, and it works so far altho i havent added the bandaid yet. was this how you meant for it to be done?

so the next step would be to create a bandaid. and in the AI-bot (the bot that i am testing all this on), in the AI-bots eventgraph i do some event that clears the time if he picks up the bandaid.

how does this part work?

i got everything set up now, from dealing bleeding-damage to the player that gets shot, and having a bandaid that he can pickup. but i cant get the timerhandle youre talking about so even tho he overlaps the bandaid he still dies.

heres screenshots:

how the bandaid pickup looks like:

how the firstpersoncharacters BP looks like, the part with the linetracegun:

how my AI-bot (the bot i am testing all this on) blueprint looks like. “stopbleed” is supposed to run when the AIbot picks up a bandaid. but i get a error here it appears i cant use the timerhandle from my other charachter.

and some details about the error.

I can’t see the attachments. Also the picture in your second last post is wrong.

The BLEED Event should be connected to the ApplyDamage-Node (with the white wire) and behind the “SetTimerByEvent” should be a SET node where you save the ReturnValue (the TimerHandle) and nothing else.
You can’t otherwise interact with the running timer. Drag the ReturnValue out and do “promote to variable”.

You can the use that TimerHandle variable to call “Clear” on it when someone picks up the bandage.
It’s pretty straight forward. If you don’t know how to work with timers then google a bit. There are tons of tutorials about them.
probably also has something by Mathew Wardstein

yeah, i found someone looking for the exact same solution as me today. no idea how i missed that one before, i googled a lot before starting this thread lol. oh wellll. heres the solution i found;

only thing i had to do was to tamper a little with the “stop bleeding” to implement the healthpickup.

so my BP looks like this now, and it seems to be working. but if you see something odd then please help! :slight_smile: one thing that i noticed right away was that the damage keeps on ticking. after the player bleeds out from hitting 0 health, the health keeps declining to “-10 -> -20 -> -30”. im 100% sure i saw a tutorial on that somewhere tho so ill figure it out.

First of all:

“SetTimerByFunctionName”. I already wrote that at least once. It has a return value. Darker blue color pin on the right side of the node.
That is the TimerHandle. Drag that out, release on an empty spot and use “Promote To Variable”.

You can then use that TimerHandle in the “EventBeginOverlap” to CLEAR the timer. At least this is how it’s usually done.

For the -10, -20 thing: Your Bleeding loops, even if you “Die”. The correct thing would also be clearing the timer when you die.
Even if you stop it with the Branch (Health <= 0.0), it will still loop the whole time. Just clear it with the TimerHandle (or the way you did it on the lower right).

For the rest of it I can only give a tip: Create yourself an Event that handles dealing damage. Something that has a FLOAT Input. And then use that Event to du “Health - FLOATInput”.
Otherwise you write the same logic over and over again.

And I should also mention: Currently, everytime the player gets hurt, it will reset the timer. The correct way would be making sure that the timer is not already running.
You can also use the TIMERHANDLE for that. There is a function that you can call on it that is something like “IsTimerActorByHandle” or something like that.

And the second thing that I see is that you stop bleeding on general overlap. Remember that this “ActorBeginOverlap” gets called for all kinds of overlaps.
You should either cast teh “OtherActor” to your Bandage Actor and only stop bleeding when that succeeds,
OR
Let the Bandage Actor clear the timer by using its own Overlap event.

But yeah, if it’s working then I would leave it for now. It’s all a learning process :stuck_out_tongue:

this is gold :slight_smile: thanks for the tips. i havent implemented them yet but i will :slight_smile:

here is what I got so far:

https://.com/watch?v=L20wXhqMqXI

idk why its 480P video. but the strings print the damage etc. and when I run into him the timer resets, just like you said “on any overlap event” i’ll fix that later. but i dont think that the timer resets when he gets hit with the weapon though if that was what you meant? i can shoot him several times and timer doesnt stop, which is how its supposed to be.

i’ve got another question. see all the animations in there? i want them to play depending on where the player got hit. i got 2 different limp animations, currently its running all the time as you can see in the video. i only want that limp animation to play if he got shot in the “thigh_l” bone etc etc.