Destroying when 0 health

Hi,

I have 2 characters. Both have some health points. If one guy shoots opponent, opponents health goes lower. Now when the health reaches below 0 by one of the guys he should get a widget and the pawn should be destroyed.

So far I managed to get the widget working, but not the destroying.

On AnyDamage Event the health variable changes and fires notify, in notify the HealthWidget changes, so everyone can see health go down. Then if health is below 0, I get the owner (=Contoller) and send message to create widget, then destroy actor. But it doesnt destroy anything.

If I replace the red part with just destroy actor it will work. But I still need the widget.
Btw. It all happens on Character
I dont know what to do.
Please Help

Yes, weird. How about using a sequence node? One branch is destroy, the other, the widget…

It destroys, but no widget.
It doesnt even go into the Dead Widget function (Does not enter IF).

Ok, so the actor is dying before the widget is shown… Presumably, if you put up the widget and have a short delay before destroying the actor, that would work. I’m not a multiplayer expert though…

Delay is now allowed in functions. And it doesnt even go into the IF branch. So it is not creating widget.
And the IF is needed, because widget can only be assigned to local controllers

Ah, you said in the beginning the widget was working…

Sorry, I have to bail there. No idea… :-/

Widget works without sequence, if I add it, widget doesnt work, destroying works

You can’t put delays in function but you can set a timer.

1 Like

Yea, was experimenting and solved it.

image

2 Likes