llSetDamage
void llSetDamage(float Damage)Sets the amount of damage that will be done to an avatar that this task hits. Task will be killed.
Sets the amount of damage that will be done to an avatar that this object hits. This object will be destroyed on damaging an avatar, and no collision event is triggered.
Parameters
-
Damage(float)
For an avatar to take damage when the object collides with an avatar:
- The object must not be phantom or have volume detect enabled
- The avatar must be on land where “Safe (no damage)” is disabled
- Note: The object does not need to be on or even partially over damage enabled land
- When these conditions are met, the avatar receives the damage, and the object will die without calling 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 be 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”Simple Auto-Killer Bullet
Section titled “Simple Auto-Killer Bullet”This will instantly “kill” on collision if contact is made with an 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. } 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. }}Related Concepts
Section titled “Related Concepts”- Damage - How damage works in Second Life
- Death - The concept of death in Second Life
- Combat - Combat mechanics in Second Life
- Weapon - Weapon development in Second Life