Get pawn - cast to pawn - get variable that is same on all possible pawns? (show hud hp for all)

As you guessed already, parent class is probably the best way to do this. You can just have an empty pawn/character parent class and add the variables that are common to all characters derived from it (like say health). You can then right click on the parent class blueprint in the content browser and then select ‘Create Blueprint based on this’ to create your child characters. Now you only need to cast to the parent class when taking any variable that’s common to all your units.

Hi!

Ive been working on my game with the template character. Now I finaly added another character so I need to redo all things where I “cast to template character”.

Here is how i did the stuff so far: http://i.imgur.com/nlg2aiY.png?1

This is on a widget that I made to show hp of the character on the HUD. Now if I switch the pawn the cast obviously fails. I would like to know how to properly set everything up so I can have multiple characters without making a new hud for everyone of them. I also thought I could do a generic cast to character to get the hp, but that doesnt work.

I thoguht well one way would be to save it extra for every character into something like gamemmode wich would pump up traffic unnecsessary. (since gammeode only exist on servers?)

Should I store all hp of all players into an array to read from them? If so into the gamestate? (as gamestate exists on clients too right?)

Or should I make a parent class and do the variable there? Ive never worked with parent classes am I missing out on anything?

Or is there a better way I didnt think about yet?

regards

SOLVED WITH HELP OF STORMRAGE

some further resources:

this (simple picture) for variables: http://i.imgur.com/6Qd9hfm.png

and this for events: https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprints_Advanced/2_5/index.html