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. 

Health/Damage System for Player, Enemy, objects, etc


I currently have health/shield/armor variables with values for my enemy character and a system for taking damage as well.

However, I also want the same system for objects, players, and other things. How can I implement the same system by just designating it without recreating the variables and functions all over again?alt text

Basically, using a health/armor/shield system across multiple characters/actors without having to redo stuff like variables and functions, so that if an actor has this blueprint, they have HP, Armor, and shields and can take damage.

Product Version: UE 4.16
more ▼

asked Jan 14 '18 at 01:14 AM in Blueprint Scripting

avatar image

7 3 7 10

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

1 answer: sort voted first

Hi there

What you need here is a base class for all your character which will hold all those common variables and functions. You can then create child blueprints for your players and enemeis from this base class and they will all have these properties copied to them which are originally defined in the parent class. In object-oriented terms, this is called inheritance. Take a look at these 2 answers (link1, link2) here where I explain how to use inheritance and concept of a base classes in your game design and within blueprints. You can take this even further using another object-oriented concept called polymorphism. This will allow you to define interface functions in the parent class, with their unique implementation in each child. From there you can use this base class as the argument, pass it around and any these interface function. It will automatically link to the specific child and call the unique implementation in that child. Polymorphism is an advanced topic and can be a bit confusing at first. However, once you understand it, your whole coding and scripting will significantly improve! Take a look at these other 2 answers (link1, link2) here where I explained this concept and how it can be applied in these specific scenarios (You can think of these questions as examples to better understand this concept).

Hope this helps :)


more ▼

answered Jan 14 '18 at 01:42 AM

avatar image

1.5k 10 10 17

avatar image SgtFlexxx Jan 14 '18 at 08:59 PM

Thank you! I think what you posted is what im looking for and I started to put it into practice.

(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