Download

Referencing to a variable

Hey fellow forumers, I am trying to add spikes to my game, if a hero jumps on top of it (trigger volume is placed there) then some amounto f his health will subtracted away from him.

The only problem is that I cannot find the “cast to” blueprint on my bp finder… thus I cannot even start the referencing to the health variable :frowning:

Any help would be appreciated.

kind Regards

Hi, you should consider using the damage system built into the engine. There is an ‘apply damage to actor’ node that you could call on the overlap event, then in your character bp, use an ‘on receive damage’ node and subtract the damage from your health variable.

However if you are dead set on accessing the health variable from (I’m assuming) the level blueprint, you should first add a ‘get player character’ node and then drag a line from the blue pin and release it in an empty space, then in the search box type ‘cast to’ from there you now have a reference to your character and can get access to the variables…I would recommend using the damage system though as the spikes would be able to cause damage to anything.