Difference between revisions of "LlDetectedDamage"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/detected|number|damage}}
|func_id=?
|func_id=33|func_sleep=0.0|func_energy=10.0
|func_sleep=0.0
|func_energy
 
|sort=DetectedDamage
|sort=DetectedDamage
|func=llDetectedDamage|return_type=list|p1_type=integer|p1_name=number
 
|func=llDetectedDamage
|p1_type=integer
|p1_name=number
|return_type=list
|return_text=containing pending damage information.
 
|func_footnote=Returns an {{HoverText|empty list|{{list}}}} if {{LSLP|number}} does not relate to a valid damage source or if called from a handler other than [[on_damage]]
|func_footnote=Returns an {{HoverText|empty list|{{list}}}} if {{LSLP|number}} does not relate to a valid damage source or if called from a handler other than [[on_damage]]
The list has the following format:
<syntaxhighlight lang="lsl2">
[float damage, integer damage_type, float original_damage]
</syntaxhighlight>
|func_desc
|func_desc
|Return_text= containing pending damage information.
|spec=
|spec=
llDetectedDamage returns a list describing a single damage event. This function is only available from within an [[on_damage]] handler. If called from another detection event or from a non detection handler, it will return an empty list.
===={{LSL Param|damage}}====
{{LSLP|damage}} is the current amount of damage that will be applied after all [[on_damage]] events have completed processing.
===={{LSL Param|damage_type}}====
{{LSLP|damage_type}} is an integer describing the type of damage that will be applied. This could either reflect one of the DAMAGE_TYPE_* constants, a custom damage type constant or be a repurposed field as it can be set to anything.
===={{LSL Param|original_damage}}====


llDetectedDamge returns a list describing a single damage event. This function is only available from within an [[on_damage]] handler. If called from another detection event or from a non detection handler, it will return an empty list.
{{LSLP|original_damage}} is the original amount of damage that was specified when the event was triggered. Either through a collision or a call to [[llDamage]].


The list has the following format: [&nbsp;[[float]]&nbsp;{{LSL Param|damage}},&nbsp;[[integer]]&nbsp;{{LSL Param|damage_type}},&nbsp;[[float]]&nbsp;{{LSL Param|original_damage}}&nbsp;]


; {{LSL Param|damage}}:The current amount of damage that will be applied after all [[on_damage]] events have completed processing.
; {{LSL Param|damage_type}}:An integer describing the type of damage that will be applied to the avatar.
; {{LSL Param|original_damage}} : The original amount of damage that was specified when the event was triggered. Either through a collision or a call to [[llDamage]].


|caveats
|caveats
|constants={{LSL Constants/Damage_Types}}
|constants={{LSL Constants/Damage_Types}}
{{LSL_Constants/Custom_Damage_Types}}
|examples=
|examples=
|helpers
|helpers

Latest revision as of 13:13, 10 August 2024

Summary

Function: list llDetectedDamage( integer number );

Returns a list containing pending damage information.

• integer number

Returns an empty list if number does not relate to a valid damage source or if called from a handler other than on_damage

The list has the following format:

[float damage, integer damage_type, float original_damage]

Specification

llDetectedDamage returns a list describing a single damage event. This function is only available from within an on_damage handler. If called from another detection event or from a non detection handler, it will return an empty list.

damage

damage is the current amount of damage that will be applied after all on_damage events have completed processing.

damage_type

damage_type is an integer describing the type of damage that will be applied. This could either reflect one of the DAMAGE_TYPE_* constants, a custom damage type constant or be a repurposed field as it can be set to anything.

original_damage

original_damage is the original amount of damage that was specified when the event was triggered. Either through a collision or a call to llDamage.

Flag Description
DAMAGE_TYPE_IMPACT −1 System damage generated by impact with terrain or a prim.
DAMAGE_TYPE_GENERIC 0 Generic or legacy damage.
DAMAGE_TYPE_ACID 1 Damage caused by a caustic substance, such as acid.
DAMAGE_TYPE_BLUDGEONING 2 Damage caused by a blunt object, such as a club.
DAMAGE_TYPE_COLD 3 Damage inflicted by exposure to extreme cold.
DAMAGE_TYPE_ELECTRIC 4 Damage caused by electricity.
DAMAGE_TYPE_FIRE 5 Damage inflicted by exposure to heat or flames.
DAMAGE_TYPE_FORCE 6 Damage inflicted by a great force or impact.
DAMAGE_TYPE_NECROTIC 7 Damage caused by a direct assault on life-force.
DAMAGE_TYPE_PIERCING 8 Damage caused by a piercing object such as a bullet, spear, or arrow.
DAMAGE_TYPE_POISON 9 Damage caused by poison.
DAMAGE_TYPE_PSYCHIC 10 Damage caused by a direct assault on the mind.
DAMAGE_TYPE_RADIANT 11 Damage caused by radiation or extreme light.
DAMAGE_TYPE_SLASHING 12 Damage caused by a slashing object such as a sword or axe.
DAMAGE_TYPE_SONIC 13 Damage caused by loud noises, like a Crash Worship concert.
DAMAGE_TYPE_EMOTIONAL 14

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.

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
DAMAGE_TYPE_MEDICAL 100 Negative damage to heal a wound, damaged limb, first aid, etc. Intended for generic healing of biological nature. Positive damage would be medical malpractice Nexii Malthus Vertical Sim / SLMC
DAMAGE_TYPE_REPAIR 101 Negative 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 Malthus Vertical Sim / SLMC
DAMAGE_TYPE_EXPLOSIVE 102 Damage caused by an explosive blast, like a grenade DAMAGE_TYPE_FORCE Nexii Malthus Vertical Sim / SLMC
DAMAGE_TYPE_CRUSHING 103 Damage caused by crushing. Such as being crushed by water pressure. More of a constant type of force damage — can be nullified/reduced via diving suit DAMAGE_TYPE_FORCE Nexii Malthus Vertical Sim / SLMC
DAMAGE_TYPE_ANTI_ARMOR 104 Damage caused by anti-tank/anti-armor. Such as from a specialised armor piercing shell, rocket or other munition DAMAGE_TYPE_PIERCING Nexii Malthus Vertical Sim / SLMC
DAMAGE_TYPE_SUFFOCATION 105 Damage caused by suffocation. Usually lacking a breathable atmosphere, such as from drowning or being in the vacuum of space Nexii Malthus Vertical Sim / SLMC

Examples

See Also

Events

•  on_damage

Functions

•  llAdjustDamage

Deep Notes

Signature

function list llDetectedDamage( integer number );