Download

How to affect variables of actors hit by line trace

Hey Guys, I have a health float on several of my pawns and I want to be able to subtract from their health value everytime they are hit by a line trace. THis is as far as I’ve gotten. Does anyone know what to do next?

Hello,
You ever did all the job ^^ Now you have check that the hit actor is the one you wants, drag from as bp plane output a wire and type the name of your variable / custom event /function you want to modify / use.

Edit : Use the exec to do what you want concerning this blueprint and then use the failed exec to continue your event with other blueprints if you need.

^ Just to add to that, make sure your Health variable is public (the eye is checked) or better yet make a public function on BP_Plane to decrease health.

Thanks for the help guys, this is what happens when i try to drag a wire from the cast to bp plane. I tried dragging from the as BP Plane pin but for some reason it doesn’t stay connected.
b8a465980ea3451cc8681b9a3a40631a63064a9c.jpeg

The SetHealth node calls SetHealth on a MyCharacter instance, so it requires a MyCharacter or anything that inherits from that. Does your BP_Plane blueprint inherit from the MyCharacter blueprint?

Maybe you have multiple blueprints with a Health variable, make sure that you do select the right SetHealth node then. Like Fen said, if you drag off BP_Plane then SetHealth should appear in the list of valid options.

WHooops! I got the wrong variable. It was supposed to be sethealth not sethealthvalue which is on mycharacter not bpship