llSetDamage
function
Function syntax
llSetDamage(float damage// Float damage value to set (range -100.0 for full heal to 100.0 for instant kill).
);- Energy
- 10
Sets the amount of damage delivered when this object hits an avatar. The object is immediately destroyed upon inflicting damage, and no collision event is triggered.
Sets the amount of damage that will be done when this object hits an avatar.
llSetDamage(0.0);Specification
Section titled “Specification”For an avatar to take damage when the object collides with an avatar…
- The object must not be
phantomorllVolumeDetect(TRUE) - The avatar must be on the land where “Safe (no damage)” is disabled.
- The object however does not need to be on or even partially over damage enabled land.
When these preconditions are met, the avatar receives the damage, and the object will die without calling the collision events.
Caveats
Section titled “Caveats”- damage is a Prim Property, and may be applied even if there is no running script.
- If damage is 100.0 or greater, the object will instantly kill even a fully healthy avatar.
- If damage is less than zero, the avatar will he healed for the indicated amount.
- If a damage enabled object hits a physics enabled object that one or more avatars are sitting on, damage will be distributed to all seated avatars.
Examples
Section titled “Examples”Example 1
5 collapsed lines
//Simple autokiller bullet:// This will instantly "kill" on collision if contact is made with avatar on damage enabled land.
default{ on_rez(integer param) // Becomes active when rezzed. { llSetDamage(100.0); // Set the damage to maximum. llSensor("", "", AGENT, 96.0, PI); // Sweep a 96 meter sphere searching for agents. }15 collapsed lines
sensor(integer num) // If an agent is detected... { llSetStatus(STATUS_PHYSICS, TRUE); // Enable physics to allow physical movement. llSetTimerEvent(10.0); // Set a 10 second timer. llMoveToTarget(llDetectedPos(0), 0.5); // Move to the detected position. } no_sensor() // If no agents are detected... { llDie(); // Auto destruct. } timer() // If we missed our target... { llDie(); // Auto destruct. }}See also
Section titled “See also”Articles
Section titled “Articles”- Damage — How damage works in Second Life
- Death — The concept of death in Second Life
- Combat — Combat in Second Life
- Weapon — Weapons in Second Life
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.