Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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


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?


Product Version: Not Selected
more ▼

asked Apr 18 '15 at 03:16 PM in Blueprint Scripting

avatar image

61 13 17 20

avatar image t0b4cc0 Apr 19 '15 at 12:13 PM


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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 18 '15 at 03:23 PM

avatar image

1k 83 75 118

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question