How to get a shield that negates damage?

Hello, i am trying to create a shield that you get from crossing a box (blueprint from static mesh actor) that is attatched to my controlled ball, to either negate incoming damage once, or return equal health upon taking damage, then to be toggled off until crossing another boost-box

However i cant seem to reference the shield BP antwhere else than in my level blueprint, where i cant put the rest of my pickups that damage the player, if that makes any sense?

If i try getting actors/components from class, it needs an “object” to target, and i dont know what it wants from me :confused:

Regards

  • Niku

Hmm, it’s strange, a lot of my nodes have different inputs and outputs from yours, might have to do with me not using a character at all in this project?

This is the response im getting from trying to set it up :o

Aha, that fixed the connections, but unfortunately it just spawned the shield on the ground, disconnected from my ball, and no damage was prevented :frowning:

I did manage to make it work in the end, a lot of messy connections, but i guess it works for now :smiley:

Thanks for the contribution, much apreach!

its alot like your other question, you have your shield actor and you just need a littlbe bit of script in it which runs when the player overlaps it. in this case we can just set a variable in the player (HasShield) to true. then in the player you can have the script needed to enact the changes to damage.

return equal health upon taking damage,

negate incoming damage once

the other option would be to create a actor which gets attached to the player either as a child component or as its own actor to intercept the damage but thats a bit more complex.

you added the HasShield variable in the shield actor and not in the ball bp thats why they look different. so just change the location of the variable to be located in the ballBP. guess it wasnt the clearest the way its written.

im not even sure how you managed to get the variable in your ball without a reference.

The fault is all mine (probably :P)
Im still just a few months into unreal, so its hard to explain properties and desired effects properly still.

Im sure it’s not the best system i’ve set up, but its a schoolproject to learn mostely so i still have a ways to go!

you never mentioned anything about spawning so i didnt do anything with that in the example. as for not preventing damage that all depends on how you have damage implemented. for my example i went with the approach of all damage to the player being routed through the event any damage. if you have other actors that are modifying the health variable of the player directly then it wont work. also setting the health of the player from an outside source is not the best way to handle things. for damage systems i personally think its a good idea to use the inbuilt system whenever possible. the inbuilt system uses the apply damage nodes and the event damage nodes which makes things convienent since you wont have to cast or deal with particular classes. also many classes have built in damage options you can make use of.