Difference between revisions of "Category:LSL Combat2"

From Second Life Wiki
Jump to navigation Jump to search
(Add Combat Log to additional)
(Introduction, headlines, use them fancy define rows I saw on experience tools. I just put introduction together based on what Rider wrote and some of the descriptions of stuff and what I know so far ¯\_(ツ)_/¯)
Line 1: Line 1:
{{Help}}{{LSL Header|ml=*}}
{{Help}}{{LSL Header|ml=*}} __NOTOC__


Linden Combat 2
The Combat2 is an enhancement to the Linden Combat system.


Description
This is not meant to be a complete combat system on its own but to provide the tools that allow you to do that.


High Level Feature
In Second Life there are a host of combat communities scattered across the grid. These communities use a wide variety of combat systems, HUDs and weapon systems. Some are completely custom, relying on scripts to arbitrate health and damage, while others are based on the Linden Lab Combat System (LLCS). See [[Combat]] for more.


Putting It All Together
The goal of the Combat2 project is to provide a coherent set of tools and systems that allow the residents to create complex and compelling combat systems using a common and easy to use framework.


Introduced are new concepts:


----
* Damage events
** If a script (object, vehicle or attachment) has a damage event this will be called first before damage is applied and scripts may modify the actual amount of damage
* Objects can have health
* Combat log records all damage events, damage adjustments and kills
** Contains system generated combat log messages by a specific system ID that scripts can filter to
** Scripts may write to this channel if not restricted by the region
* Region-wide settings, region owners may:
** Throttle damage to limit how much damage a single source may inflict on a target per second
** Select a number of options as to what happens when agent health drops to 0 such as:
*** Teleport home (same as old LLCS)
*** Teleport to region's telehub
*** Teleport to parcel's landing point
*** No action
** Set a brief period of invulnerability, during which agents may neither deal nor receive damage
** Whether health is reset to 100% on death
** Tweak the speed of health regeneration per second
** Whether scripts are allowed to adjust damage or write to the combat log


==Testing==
Start playing with it and build interesting things.


There are two regions on the beta grid open and available for testing:
There are two regions on the beta grid open and available for testing:
Line 19: Line 40:




----
==Scripting==
{|
{{LSL DefineRow|key|[[llRezObjectWithParams]](string inventory, list params)|New }}
{{LSL DefineRow|void|[[llAdjustDamage]](integer number, float new_damage)|Modifies the amount of damage that will be applied by the current [[on_damage]] event after it has completed processing}}
{{LSL DefineRow|void|[[llDamage]](key target, float damage, integer damage_type)|Delivers damage to tasks and agent in the same region of {{LSLGC|Constants/Damage Types|DAMAGE_TYPE_*}}. Negative damage can be used to heal instead}}
{{LSL DefineRow|list|[[llDetectedDamage]](integer number)|Returns a list describing a single damage event within an [[on_damage]] event}}
{{LSL DefineRow|key|[[llDetectedRezzer]](integer number)|Returns a key that is the UUID of the object or avatar that rezzed the detected object}}
{{LSL DefineRow|float|[[llGetHealth]](key id)|Returns the current health of an avatar or object in the region}}
{{LSL DefineRow|event|[[on_damage]](integer num_detected)|Triggered when damage has been inflicted on an avatar or task in the world but before damage has been applied or distributed}}
{{LSL DefineRow|event|[[final_damage]](integer num_detected)|Triggered after after all [[on_damage]] events in all scripts and attachments have processed and damage has been applied to the avatar or distributed to all seated avatars}}
{{LSL DefineRow|event|[[on_death]]()|Triggered on all attachments worn by an avatar when that avatar's health reaches 0 (-- Does this trigger on objects too Rider?)}}
{{LSL DefineRow|integer|[[COMBAT_CHANNEL]]|Channel reserved for combat related log events broadcast to the entire region}}
{{LSL DefineRow|key|[[COMBAT_LOG_ID]]|Scripts may filter [[llListen]] calls to this ID to receive only system generated combat log messages}}
|}




Functions:
==Additional==


* [[llAdjustDamage]] — Modifies the amount of damage that will be applied by the current [[on_damage]] event after it has completed processing.
* [[llGetEnv]] — Several new values are added
* [[llDamage]] — Delivers damage to tasks and agent in the same region.
** "allow_damage_adjust" — Are scripts allowed to adjust damage
* [[llDetectedDamage]] — Returns a list containing pending damage information.
** "restrict_combat_log" — Are scripts allowed to write to the combat log
* [[llDetectedRezzer]] — Returns a key that is the UUID of the object or avatar that rezzed the detected object number.
** "restore_health" — Is health reset to 100% on death
* [[llGetHealth]] — Returns the current health of an avatar or object in the region.
** "invulnerability_time" — Invulnerablitiy time applied after avatar death
** "damage_throttle" — The maximum number of points of damage a single source may inflict on a target per second
** "health_regen_rate" — The speed of health regeneration in hitpoints per second
** "death_action" — Set the action to take when an avatar dies in the region
* [[llGetObjectDetails]]
** [[OBJECT_HEALTH]] — Retrieves the health of an avatar or prim
** [[OBJECT_DAMAGE]] — Retrieves the amount of damage a prim inflicts on collision
** [[OBJECT_DAMAGE_TYPE]] — Retrieves the type of damage a prim inflicts on collision
* [[llRezObjectWithParams]]
** [[REZ_DAMAGE]] — The amount of damage applied to an agent upon collision with this object
** [[REZ_DAMAGE_TYPE]] — The damage type to apply when this prim collides with another object
* Combat Log has been added which allows for auditing damage events, there is a channel reserved at [[COMBAT_CHANNEL]] which will contain system generated combat log messages by [[COMBAT_LOG_ID]] and scripts may listen and additionally also write to this channel if the region allows it (see "restrict_combat_log" above)




Events:
==Related==


* [[on_damage]] — Triggered when damage has been inflicted on an avatar or task in the world but before damage has been applied or distributed.
* Thread on the Second Life community forums by Rider Linden announcing the project: [https://community.secondlife.com/forums/topic/506317-pew-pew-pew-linden-damage-combat-20/ Pew! Pew! Pew! Linden Damage & Combat 2.0]
* [[final_damage]] — Triggered after after all [[on_damage]] events in all scripts and attachments have processed and damage has been applied to the avatar or distributed to all seated avatars.
* [https://feedback.secondlife.com/combat-20 Feedback for suggesting, voting and commenting on ideas]
* [[on_death]] — Triggered on all attachments worn by an avatar when that avatar's health reaches 0.
 
 
Additional:
 
* [[llGetEnv]]
** "allow_damage_adjust" — Are scripts allowed to adjust damage.
** "restrict_combat_log" — Are scripts allowed to write to the combat log.
** "restore_health" — Is health reset to 100% on death.
** "invulnerability_time" — Invulnerablitiy time applied after avatar death.
** "damage_throttle" — The maximum number of points of damage a single source may inflict on a target per second.
** "health_regen_rate" — The speed of health regeneration in hitpoints per second.
** "death_action" — Set the action to take when an avatar dies in the region.
* [[llGetObjectDetails]]
** [[OBJECT_HEALTH]] — Retrieves the health of an avatar or prim.
** [[OBJECT_DAMAGE]] — Retrieves the amount of damage a prim inflicts on collision.
** [[OBJECT_DAMAGE_TYPE]] — Retrieves the type of damage a prim inflicts on collision.
* [[llRezObjectWithParams]]
** [[REZ_DAMAGE]] — The amount of damage applied to an agent upon collision with this object.
** [[REZ_DAMAGE_TYPE]] — The damage type to apply when this prim collides with another object.
* Combat Log
** [[COMBAT_CHANNEL]] — Channel reserved for combat related log events broadcast to the entire region.
** [[COMBAT_LOG_ID]] — Scripts may filter [[llListen]] calls on this ID to receive only system generated combat log messages.

Revision as of 20:25, 19 May 2024

The Combat2 is an enhancement to the Linden Combat system.

This is not meant to be a complete combat system on its own but to provide the tools that allow you to do that.

In Second Life there are a host of combat communities scattered across the grid. These communities use a wide variety of combat systems, HUDs and weapon systems. Some are completely custom, relying on scripts to arbitrate health and damage, while others are based on the Linden Lab Combat System (LLCS). See Combat for more.

The goal of the Combat2 project is to provide a coherent set of tools and systems that allow the residents to create complex and compelling combat systems using a common and easy to use framework.

Introduced are new concepts:

  • Damage events
    • If a script (object, vehicle or attachment) has a damage event this will be called first before damage is applied and scripts may modify the actual amount of damage
  • Objects can have health
  • Combat log records all damage events, damage adjustments and kills
    • Contains system generated combat log messages by a specific system ID that scripts can filter to
    • Scripts may write to this channel if not restricted by the region
  • Region-wide settings, region owners may:
    • Throttle damage to limit how much damage a single source may inflict on a target per second
    • Select a number of options as to what happens when agent health drops to 0 such as:
      • Teleport home (same as old LLCS)
      • Teleport to region's telehub
      • Teleport to parcel's landing point
      • No action
    • Set a brief period of invulnerability, during which agents may neither deal nor receive damage
    • Whether health is reset to 100% on death
    • Tweak the speed of health regeneration per second
    • Whether scripts are allowed to adjust damage or write to the combat log


Testing

Start playing with it and build interesting things.

There are two regions on the beta grid open and available for testing:


Scripting

• key llRezObjectWithParams(string inventory, list params) New
• void llAdjustDamage(integer number, float new_damage) Modifies the amount of damage that will be applied by the current on_damage event after it has completed processing
• void llDamage(key target, float damage, integer damage_type) Delivers damage to tasks and agent in the same region of DAMAGE_TYPE_*. Negative damage can be used to heal instead
• list llDetectedDamage(integer number) Returns a list describing a single damage event within an on_damage event
• key llDetectedRezzer(integer number) Returns a key that is the UUID of the object or avatar that rezzed the detected object
• float llGetHealth(key id) Returns the current health of an avatar or object in the region
• event on_damage(integer num_detected) Triggered when damage has been inflicted on an avatar or task in the world but before damage has been applied or distributed
• event final_damage(integer num_detected) Triggered after after all on_damage events in all scripts and attachments have processed and damage has been applied to the avatar or distributed to all seated avatars
• event on_death() Triggered on all attachments worn by an avatar when that avatar's health reaches 0 (-- Does this trigger on objects too Rider?)
• integer COMBAT_CHANNEL Channel reserved for combat related log events broadcast to the entire region
• key COMBAT_LOG_ID Scripts may filter llListen calls to this ID to receive only system generated combat log messages


Additional

  • llGetEnv — Several new values are added
    • "allow_damage_adjust" — Are scripts allowed to adjust damage
    • "restrict_combat_log" — Are scripts allowed to write to the combat log
    • "restore_health" — Is health reset to 100% on death
    • "invulnerability_time" — Invulnerablitiy time applied after avatar death
    • "damage_throttle" — The maximum number of points of damage a single source may inflict on a target per second
    • "health_regen_rate" — The speed of health regeneration in hitpoints per second
    • "death_action" — Set the action to take when an avatar dies in the region
  • llGetObjectDetails
  • llRezObjectWithParams
    • REZ_DAMAGE — The amount of damage applied to an agent upon collision with this object
    • REZ_DAMAGE_TYPE — The damage type to apply when this prim collides with another object
  • Combat Log has been added which allows for auditing damage events, there is a channel reserved at COMBAT_CHANNEL which will contain system generated combat log messages by COMBAT_LOG_ID and scripts may listen and additionally also write to this channel if the region allows it (see "restrict_combat_log" above)


Related