llSetDamage(float damage)
Sets the amount of
damage that will be done to an
avatar that the
scripted object collides with. The scripted object will
die (be deleted) immediately on colliding and no
event handlers will be executed first.
damage is a percentage (0 - 100), with 100% meaning instant death on colliding with the object. Lower
values will damage the avatar and kill it if its life energy (indicated in the middle of the
menu bar on the
Second Life client) is lower or equal to the damage.
This function only has an effect on damage-enabled
land. Anywhere else it does nothing and the object
will not die on collisions. If you need it to die, it's recommended you use
llDie in the
collision event.
I noticed (as probably many) that a damage object colliding with another object that an avatar is sitting on will inflict the damage percentage to the avatar, which is kinda annoying, especially when trying to make an armored vehicle. -AgentRevolution
At least as of
SL 1.5, negative values do
not heal the victim. Values outside the 0-100 range are treated as 100% (i.e. instant kill).
example script
//By James Benedek
//50% Damage Script For Linden Damage Land
default
{
state_entry()
{
llSetDamage(50);//will take 50% health from the avatar who collides with the object with this script in
}
}
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
damage