Getting & Setting Variable from different Class Blueprints

Hello everyone!

I would like to know if it is possible to get & set a float variable in a blueprint (CurrentHP) before “knowing” in which blueprint i want to get/set it?

What i a trying to do is the following:
I am building a basic hack n slash game where my player swings a weapon and on each weapon swing i check if the weapon hitbox collides with a “monster” hitbox. I made the whole thing work with one specific monster. But now i wanna use different types of monsters (and blueprint classes). Therefor i did create a parent “monster” class and will have several different monster childs from that parent.
In my Player Character Blueprint i check if the weapon collission hit a child of the monster class and if so loop the hit monsters to get damage. The CurrentHP float is saved in the different child classes. Now i would like to know how to set the CurrentHP float variable?

Thanks in advance! I hope i did manage to describe my problem in a understandable way…

Hey all!

I managed to solve the problem after talking about it with a buddy.
I went at it the wrong way around and i am a newb to parent classes (well, to programming and UE4 in general :wink: ).

I did not know that all childs inherit the variables from the parent class. So, i set up a “CurrentHP” float in the parent class and also made a custom event there (“GetDamage”) which gets triggered in the PlayerCharacter Blueprint. See enclosed Screenshots.

Maybe this solution can help someone else with similar problems. If there is a better way to solve the problem, please let me know!