llDetectedDamage

From Second Life Wiki
Revision as of 14:33, 7 June 2024 by Rider Linden (talk | contribs)
Jump to navigation Jump to search

Summary

Function: list llDetectedDamage( integer number );
0.0 Forced Delay
10.0 Energy

Returns the list containing pending damage information.

• integer number Index of detection information

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

Specification

llDetected* functions only work if called from within Detection events (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) or in functions called by Detection events. They will fail silently and return unusable values if called during other events. 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.

The list has the following format: [ float damage, integer damage_type, float original_damage ]

damage
The current amount of damage that will be applied after all on_damage events have completed processing.
damage_type
An integer describing the type of damage that will be applied to the avatar.
original_damage
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.

Caveats

  • If number is out of bounds the script continues to execute without an error message.
  • Events that enable the llDetected* functions always return at least one detected item.
    • Detection events are not raised if there is nothing detected.[1]
    • The detection event's items detected parameter is initially never less than 1.[2]

Examples

See Also

Events

•  on_damage

Functions

•  llAdjustDamage

Articles

•  Detected

Deep Notes

Footnotes

  1. ^ The exception is no_sensor but it doesn't enable llDetected* functions.
  2. ^ Like all event parameters, the user can overwrite the initial value.

Signature

function list llDetectedDamage( integer number );