Sets the amount of damage that will be done when this object hits an avatar.

Syntax

void llSetDamage( float damage );

Forced delay: 0.0 seconds. Energy: 10.0.

Parameters

float damage
range: -100.0 (full heal) ~ 100.0 (instant kill)

Specification

For an avatar to take damage when the object collides with an avatar...

When these preconditions are met, the avatar receives the damage, and the object will die without calling the collision events.

Caveats

Examples

//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.
    }
    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

Articles