Adding damage types
Last updated
Last updated
Advanced Roleplay Environment supports modular damage types. This means you can easily add damage types or edit them accordingly.
In order to add a damage type we need to add the damage type inside the damage types file and the according damage type hash and configure the properties accordingly.
Since all damage types are saved inside script/entities/damage_types.lua
, we will open this file. This should look like this:
Now we will scroll to the bottom and just copy a damage type from above and edit it to our needs so it should look like this:
There are two options available for us to configure the damage type.
thresholds
This property is a table and contains the damage thresholds of a received damage. It works like this: If there is an entry with a damage of 1 this entry will cause n injuries (n is defined by the amount property in the entry). If there are two entries or more all entries will be executed if the damage is equal or higher than needed damage defined in the threshold entry.
thresholds = { { damage = 1, amount = 2 }, { damage = 15, amount = 3 } }
Using it like this the damage type will cause 2 injuries if the damage is >= 1. If the damage is >= 15 it will also add 3 injuries more.
selectionSpecific
This property is a boolean and contains the value if the damage type should be selection specific. So when received a leg injury if it should apply on the leg or on a random body part.
selectionSpecific = false
Using it like this the damage type will ignore where the player has been hit and choose a random body part. (Good for explosions maybe?)
In order that the damage type will be triggered we need to link it to a damage hash from the game. So lets do this.
We need to go the section ENUM_DAMAGE_HASHES and scroll down to the bottom of it and copy the last value and edit it to our needs, so it should look like this:
As you can see we've edited the hash and the category. The category is defined above here. If we have added and configured everything properly and also a injury for it, we should now receive an injury.