User:Nexii Malthus/SLMC/Damageable Objects

From Second Life Wiki
< User:Nexii Malthus‎ | SLMC
Revision as of 05:27, 4 December 2024 by Nexii Malthus (talk | contribs) (Created page with "{{LSL Header|ml=*}} __NOTOC__ {{Stub}} With the new Combat2 update it becomes possible to allow objects to be able to be damaged as well as manage...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article has been classified as a stub, you can help the Second Life Wiki by expanding this article and adding more information.


With the new Combat2 update it becomes possible to allow objects to be able to be damaged as well as manage their own health. This allows one to create scripted objects that integrate into the native combat system, from armored vehicles, damageable walls and buildings, makeshift barricades and more.


What makes an object damageable?

An object becomes damageable when it has a script with an on_damage or final_damage event. That is enough to define it as being able to process damage.


What gives an object health?

Health is a floating point value. Objects start with 0.0 health by default. An object can be given health via setting a number via PRIM_HEALTH. This property can only be changed by a call to llSetPrimitiveParams or llSetLinkPrimitiveParamsFast.

Unlike avatars the health value is not restricted and be any number even beyond 100.0.


Do damage collisions or llDamage calls automatically subtract health for objects?

No.

The simulator will not automatically set health based on damage for you, this only applies to avatars.

Instead you need to set object health via PRIM_HEALTH, manually tracking health in your script. You can track current health via llGetHealth or manage it via a global variable in your script.


Does damage to an object generate a DAMAGE event in the Combat Log?

Yes, damage events will be generated in the combat log as soon as you finish processing them in the events.


Does setting an object to 0 health generate a DEATH event in the Combat Log?

No death events will be generated by the simulator for objects.

However because the Combat Log is just a normal channel, and if writing to the Combat log is allowed by region settings, it is highly recommended to generate a custom OBJECT_DEATH event that matches the DEATH event signature. You can read more about it in the Combat Log on writing to the log.

This allows HUDs, systems and auditing tools to provide feedback to residents or be used to understand what is going on.