Difference between revisions of "LlSetDamage"

From Second Life Wiki
Jump to navigation Jump to search
(Rewrite function footnote)
Line 2: Line 2:
|func_id=157|func_sleep=0.0|func_energy=10.0
|func_id=157|func_sleep=0.0|func_energy=10.0
|sort=SetDamage
|sort=SetDamage
|func=llSetDamage|p1_type=float|p1_name=damage
|func=llSetDamage|p1_type=float|p1_name=damage|p1_desc=range: 0.0 (no [[damage]]) ~ 100.0 (instant [[death|kill]])
|func_footnote=
|func_footnote
The valid range of '''damage''' is 0.0 (no [[damage]]) ~ 100.0 (instant [[death|kill]]). To give an agent the damage with this object,
|func_desc=Sets the amount of '''damage''' that will be done when this object hits an avatar.
|return_text
|spec=
For an avatar to take damage when the object collides with an avatar...
*The object must be physical, and
*The object must be physical, and
*The agent must be on the land where "Safe (no damage)" is disabled.
*The avatar must be on the land where "Safe (no damage)" is disabled.
Once the object hits the agent, the agent receives the damage, and the object will [[llDie|die]] without [[collision]] event.
When these preconditions are met, the avatar receives the damage, and the object will [[llDie|die]] without calling the {{LSLGC|Collision|collision}} events.
|func_desc=Sets the amount of damage that will be done when this object hits an agent.
|caveats=
|return_text
*If '''damage''' is outside the range of [0, 100], it performs an instant kill.
|spec
*If the object is not over damage enabled land when it collides, the object will ''not'' die and the {{LSLGC|Collision|collision}} or {{LSLGC|Land Collision|land_collision}} events will be queued.
|caveats
*If the object is not physical, the object will be damage enabled if it becomes physical; it will however not be physical while it is not damage enabled.
*If a damage enabled object hits an object that an avatar is sitting on, the avatar receives the damage just the same as they would if they had been hit directly.
|constants
|constants
|examples=
|examples=
<lsl>
<lsl>//Simple autokiller bullet:  
//Simple autokiller bullet:  
//When it rezzed it scans for the closest person,
//When it rezzed it scans for the closest person,
//Moves to their location and kills them. (Because
//Moves to their location and kills them. (Because
Line 22: Line 25:
     on_rez(integer i) {
     on_rez(integer i) {
         llSetTimerEvent(10.0);
         llSetTimerEvent(10.0);
        llSetDamage(10000.0);
         llSensor("", "", AGENT, PI, 96.0);
         llSensor("", "", AGENT, PI, 96.0);
     }
     }
     timer() { llDie(); }
     timer() { llDie(); }
     sensor(integer num) {
     sensor(integer num) {
         for(num = 100;--num;)
         llSetStatus(STATUS_PHYSICS, TRUE);
            llSetPos(llDetectedPos(0));
        llSetDamage(100.0);
        llMoveToTarget(llDetectedPos(0), 1.0);
     }
     }
}</lsl>
}</lsl>

Revision as of 10:37, 25 May 2009

Summary

Function: llSetDamage( float damage );

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

• float damage range: 0.0 (no damage) ~ 100.0 (instant kill)

Specification

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

  • The object must be physical, and
  • The avatar must be on the land where "Safe (no damage)" is disabled.

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

Caveats

  • If damage is outside the range of [0, 100], it performs an instant kill.
  • If the object is not over damage enabled land when it collides, the object will not die and the collision or land_collision events will be queued.
  • If the object is not physical, the object will be damage enabled if it becomes physical; it will however not be physical while it is not damage enabled.
  • If a damage enabled object hits an object that an avatar is sitting on, the avatar receives the damage just the same as they would if they had been hit directly.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//Simple autokiller bullet: //When it rezzed it scans for the closest person, //Moves to their location and kills them. (Because //It collides with them) default {

   on_rez(integer i) {
       llSetTimerEvent(10.0);
       llSensor("", "", AGENT, PI, 96.0);
   }
   timer() { llDie(); }
   sensor(integer num) {
       llSetStatus(STATUS_PHYSICS, TRUE);
       llSetDamage(100.0);
       llMoveToTarget(llDetectedPos(0), 1.0);
   }
}</lsl>

Deep Notes

Search JIRA for related Issues

Signature

function void llSetDamage( float damage );