Don't click here unless you want to be banned.

LSL Wiki : llSetDamage

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
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.

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).


Functions | damage
Comments [Hide comments/form]
There seems to be a slight quirk with how llSetDamage() works, when a script is reset... Namely, if you use llSetDamage() in state_entry, and then call llResetScript() in on_rez, other events will be executed before the damage setting is applied to a prim. Specifically, if you have the above situation, and a start_collision event with llDie() in it, the prim will collide with someone, but deal no damage before it dies, suggesting that the llDie() in start_collision is being executed first.
Either don't use llSetDamage in state_entry, or don't call llResetScript(), would seem to be the solution there.
-- SylphLightworker (2006-03-13 14:20:05)
I have noticed some other quirks. If you rez a damaged enabled object inside a sitting avatar and have it move around, it will not "collide" and therefore will not apply damage to an avatar EXCEPT if the movement is done into or out of the lower third of the avatars height. It applies damage normally if the object moves into/out of the avatars bounding box. This includes the object you are sitting on, you CAN damage somebody by colliding a damage enabled object into the item that person is sitting on.
-- KokiriSaarinen (2006-06-14 01:03:42)
Attach a comment to this page: