When Health Decreases on Character
Fires whenever the health value of a character goes down, for example when it takes damage.
Introduction
When Health Decreases on Character is an event in the Character Health group of World Events. It fires whenever the health value of a character goes down, for example when the character takes damage from a weapon, a hazard, or a fall. When it fires, the event hands three values to your script: Value , how much health was lost, the Source character that dealt it, and the Source player behind that character. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. Health changes on a character always travel through this family: When Health Increases on Character covers healing, and When Health Reduces to Zero on Character fires the moment the damage is fatal. For damage sources, look at When Bullet Hits and When Melee Hit from the weapon groups, and read the Character Logic guide to wire health bars and damage rules on the asset. When Health Decreases event block in the Script Editor with Value, Source character, and Source player parameters Image The When Health Decreases on Character event in the Script Editor. caption
Parameters
Value the amount of health lost Source character the character that was damaged Source player the player behind that character Parameter Description
How to Access
How to Access - Event When Health Decreases
How to Use
Select the character, press Propertie (the blue equalizer icon) in the bottom action menu, and scroll to the bottom of the properties panel. Press Add Component and pick the Character Health component; its block stacks below the existing properties with the When Health Decreases event inside it. Press the + button below the event to add a script, then press Edit on that script to open the script editor and build the actions that should run when the event fires. Press Play, damage the character, and check that the actions run.
Example
When health decreases on a character: Execute Self Character.Jump when-health-decreases-on-character-example.png Makes the character jump the moment it takes damage. caption
Common Uses
Play a hit sound when the character takes damage Flash the screen or play a hurt animation Count damage taken for stats or scoring
Tip
Use When Health Reduces to Zero on Character instead if you only care about the moment the character is defeated.