Page cover

Health System

The Enemy AI - Toolkit comes with a simple health system that is implemented as an actor component. The purpose of this page is to provide a technical overview of the system.


Overview

At the core of the health system is the Health System Component. It provides all the necessary logic to implement a simple health system that is connected to the built-in damage system in Unreal Engine. The component is already attached to the Enemy Character Base, so you don't even have to worry about implementing it yourself in most cases.


Quick Setup

If you are not using the default enemy character base, or if you want to use the health system elsewhere and therefore need to implement it yourself, don't worry. Setting up the health system is as straightforward as anything else in this project.

All you have to do is add the component to the actor of your choice and set the default health. That's it! The health system will then automatically register any damage to the owner and apply it to the component itself.


Setup Widget Component

To see the health bar that comes with the health system, your character (or another actor, if applicable) must have a widget component. It is not necessary to have a Widget Component on the same actor to which the Health System is attached, since the Health System is decoupled from the Widget. However, when a Health Widget is assigned to an actor, that actor also needs the Health System for the widget to work (One way dependencie).

If you are using the Enemy Character Base, you should be all set, just as with the aforementioned Health System Component. Otherwise, some extra steps are required to set up the health system and widget.

  1. First, add a new widget component to your actor and set it up to use the health bar widget (or whichever widget you are using). Also, make sure it's set to world space and that the draw size is set to the exact scale of the widget you're using.


  1. In most cases, you can now proceed. The health bar widget automatically connects to the health system as long as the owning actor has a health system attached. Check that your widget looks as you want it to. If you can't see anything, make sure that all the settings are the same as in the previous step.

Last updated