Using Health Change Volumes

A Health Change Volume is a script that is put onto an object that has been set up with a trigger volume. When an entity enters the trigger volume, their health value gets changed in either a positive or negative value, or in other words, they can be damaged or healed.

The script has settings for how much damage/healing the entity should receive when they first enter the trigger, and then 2 other settings that control how much more damage/healing they should receive at what kind of interval.

To give you a better example of how this all works we have created 4 premade Damage Volumes and 1 premade Healing volume.

To find the Damage volumes just type the word "Damage" into the editor search field. Within that search you will find:


 * Lava Damage Volume
 * Explosion with Damage
 * Electrical Damage Volume
 * Smart Damage Volume Small 01
 * Smart Damage Volume Medium 01
 * Smart Damage Volume Large 01



And to find the Healing volume just type the word "Healing" into the editor search field and you will find:


 * Smart Healing Volume



Health Change Volume Script
The health change volume script is where the magic actually happens. Once that script has been dropped onto an object you will see a handful of settings:




 * Damage Type:  A variety of premade damage types that you can choose from the pull down list.  They don't do anything by themselves, they are just a tag that can be tied into damage resistances which is a topic that will be covered elsewhere.
 * Initial Health Change: When the entity first enters the trigger volume this is how much health will instantly get adjusted.  A negative number will damage them, a positive number will heal them.  The larger the number, the greater the amount of health affected.
 * Repeated Health Change: This value represents how much you want to continually change the health by while the entity is standing in the volume.
 * Health Change Frequency: This value controls how often the above value comes into play per second.  If you look at the image above, the way it is set up anyone standing in that volume would lose 10 health every half a second.
 * Collider Component: In order for the Health Change Volume to work it has to be on an object that is set up with a Trigger Volume.  You need to drag the object into this slot so it knows what trigger volume it is looking for.

Damage and Healing Volumes
Each of the Volumes are set up mostly the same.


 * The Parent object contains the trigger volume and the Health Change Volume script.
 * The Visuals child contains the art that makes up the object and could be easily swapped out for something else
 * The Audio child contains a looping sound effect to help sell the effect better. This too could be swapped out for anything or even just disabled if you didn't want any sound playing.  The Audio Source uses the Spatial Blend setting so the sound will appear to be coming from the object.
 * The Collision child contains the extra layer of collision that the player would walk on if the object needs it (and not all of them do)

Here is the list of the volumes again with some basics of how they are set up:


 * Lava Damage Volume: a circular object that would work perfect on the the top of a volcano.  It's damage volume was hooked up to the objects Mesh Collider.  This object has a collision child that was created to be just slightly smaller than the visual so when a player stands on it, they will look like they are sinking into the lava a bit, rather than just standing on the surface.
 * Electrical Damage Volume: a spherical volume that crackles with electricity.  Works great as some sort of sci fi hazard players need to find a way around.  It simply uses the EMP effect from the Racing game scaled up.
 * Smart Damage Volume Small 01 / Medium 01 / Large 01: all three of these volumes are the same, just different sized versions of each other.  These are also lava fields by default and use box trigger volumes so they can be dropped in just about anywhere.  The animating lava pattern on the visual object tiles, so you can duplicate a volume and by lining up the duplicates next to each other you can make a lava field any size you want.  Being a square volume you could swap out the visuals for anything you wanted, like dropping in Rockking Charge Dust and creating a toxic gas field.
 * Explosion with Damage: this one works slightly differently from the others.  To use it most effectively it should be triggered by some sort of event (like the death event of a vehicle or from a player activating a switch).   This object uses a spherical trigger for the damage area and once it's activated you will see an explosion fill that area, it instantly does a bunch of damage to anything inside it (anything that can take damage that is), and then it uses a timer to shut itself off so the damage volume isn't left hanging around once the effect is over.


 * Smart Healing Volume is similar to the Electrical Damage Volume, just in reverse. It's a spherical volume that is full a magical looking particles and when a damaged player stands in it, they will quickly begin to regain health.  This one was set up to not do an initial health burst change like the damage volumes, but it easily could be altered to do so.