Skip to content
lsl.devlsl.devLSL Dev

Damage Types

LSL Header: {{LSL Header|ml=*}} __NOTOC__
Damage types are an additional integer field that is passed along with the damage amount.
Whenever damage is dealt to an avatar, or an object that can process damage, an additional damage type integer is passed along to the on_damage and final_damage events through the llDetectedDamage function. It can also be retrieved via OBJECT_DAMAGE_TYPE on llGetObjectDetails for objects that use collision damage via PRIM_DAMAGE or REZ_DAMAGE_TYPE.

Specification

The damage type integer can match a default DAMAGE_TYPE_*, a custom damage type integer such as from the community damage types or for your own combat system, or even go further to repurpose the damage type fields for contained systems.
For example such as using bitshifting and/or bitmasks to achieve dual or triple damage type systems and/or sub types. Or using bit flags for your own options and enumerations. However be wary that repurposing the damage type field to such extents can create incompatibility with other systems that may process damage. Such as a third party damage report HUD the avatar may be wearing. Of course a fully self-contained/private system on the other hand does not need to worry about such issues.

Default Damage Types

Flag Description
DAMAGE_TYPE_IMPACT−1System damage generated by impact with terrain or a prim.
DAMAGE_TYPE_GENERIC0Generic or legacy damage.
DAMAGE_TYPE_ACID1Damage caused by a caustic substance, such as acid.
DAMAGE_TYPE_BLUDGEONING2Damage caused by a blunt object, such as a club.
DAMAGE_TYPE_COLD3Damage inflicted by exposure to extreme cold.
DAMAGE_TYPE_ELECTRIC4Damage caused by electricity.
DAMAGE_TYPE_FIRE5Damage inflicted by exposure to heat or flames.
DAMAGE_TYPE_FORCE6Damage inflicted by a great force or impact.
DAMAGE_TYPE_NECROTIC7Damage caused by a direct assault on life-force.
DAMAGE_TYPE_PIERCING8Damage caused by a piercing object such as a bullet, spear, or arrow.
DAMAGE_TYPE_POISON9Damage caused by poison.
DAMAGE_TYPE_PSYCHIC10Damage caused by a direct assault on the mind.
DAMAGE_TYPE_RADIANT11Damage caused by radiation or extreme light.
DAMAGE_TYPE_SLASHING12Damage caused by a slashing object such as a sword or axe.
DAMAGE_TYPE_SONIC13Damage caused by loud noises, like a Crash Worship concert.
DAMAGE_TYPE_EMOTIONAL14
Damage types are provided as a convenience and a suggestion. Scripters are free to add custom ones for their own combat systems or repurpose the damage type fields.

Community Damage Types

To make it easy for the community to recognise and re-use custom damage types here is a table that scripters can add onto:
Flag Description Subtype Creator System
100100Negative damage to heal a wound, damaged limb, first aid, etc. Intended for generic healing of biological nature. Positive damage would be medical malpracticeNexii MalthusVertical Sim / SLMC
101101Negative damage from repairing an object or something mechanical, welding torch or wrench on a vehicle/robot/mech, etc. Positive damage can be due to mistakes, low skill or sabotage. Intended for generic healing of non-biological nature (e.g. a mechanical tank or an electrical system)Nexii MalthusVertical Sim / SLMC
102102Damage caused by an explosive blast, like a grenadeDAMAGE_TYPE_FORCENexii MalthusVertical Sim / SLMC
103103Damage caused by crushing. Such as being crushed by water pressure. More of a constant type of force damage — can be nullified/reduced via diving suitDAMAGE_TYPE_FORCENexii MalthusVertical Sim / SLMC
104104Damage caused by anti-tank/anti-armor. Such as from a specialised armor piercing shell, rocket or other munitionDAMAGE_TYPE_PIERCINGNexii MalthusVertical Sim / SLMC
105105Damage caused by suffocation. Usually lacking a breathable atmosphere, such as from drowning or being in the vacuum of spaceNexii MalthusVertical Sim / SLMC
106106Special damage to indicate combatant chose to redeploy. You can code in side effect(s) such as using up a ticket off the team to do soNexii MalthusVertical Sim / SLMC
200200Damage caused by lack of survival needs, such as starvation and dehydration. Negative damage used to heal through recovery by food and waterAdam Silver-Mane (Adamphillip)Silver-mane's survival HUD
201201Damage caused by active bleeding. Damage type check, sets health to 0 on unsustainable systemic failureAdam Silver-Mane (Adamphillip)Silver-mane's survival HUD
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.