Difference between revisions of "Category:LSL Combat2"

From Second Life Wiki
Jump to navigation Jump to search
m
(Added info about DAMAGEABLE object scanning and reworked copy a bit)
Line 9: Line 9:
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.
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:
 
==Introduced are new concepts==


* Damage events
* 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
** 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
* Objects can have health and be scanned by sensors
* Combat log records all damage events, damage adjustments and kills
* Combat Log has been added which allows for auditing
** Contains system generated combat log messages by a specific system ID that scripts can filter to
** Records all damage events, damage adjustments and kills
** System generated messages by a specific ID that scripts may filter to
** Scripts may write to this channel if not restricted by the region
** Scripts may write to this channel if not restricted by the region
* Region-wide settings, region owners may:
* Region-wide settings, region owners may:
** Throttle damage to limit how much damage a single source may inflict on a target per second
** 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:
** Select a number of options as to what happens when agent health drops to 0 such as:
*** Teleport home (same as old LLCS)
**# Teleport home (same as old LLCS)
*** Teleport to region's telehub
**# Teleport to region's telehub
*** Teleport to parcel's landing point
**# Teleport to parcel's landing point
*** No action
**# No action
** Set a brief period of invulnerability, during which agents may neither deal nor receive damage
** Set a brief period of invulnerability, during which agents may neither deal nor receive damage
** Whether health is reset to 100% on death
** Whether health is reset to 100% on death
Line 41: Line 43:


==Scripting==
==Scripting==
{|
{|
{{LSL DefineRow|key|[[llRezObjectWithParams]](string inventory, list params)|New function for rezzing objects with a variety of parameters, particularly useful for avoiding the overhead of starting a script for each bullet}}
{{LSL DefineRow|key|[[llRezObjectWithParams]](string inventory, list params)|New function for rezzing objects with a variety of parameters, particularly useful for avoiding the overhead of starting a script for each bullet}}
Line 51: Line 54:
{{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|[[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|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}}
|}
|}


Line 58: Line 59:
==Additional==
==Additional==


* [[llListen]]
** Channel reserved at [[COMBAT_CHANNEL]]
** System generated combat log messages sent by [[COMBAT_LOG_ID]]
** Scripts may also write to this channel if the region allows it (see "restrict_combat_log" below)
* [[llSensor]] — Scripts may filter by [[DAMAGEABLE]] for objects in world that process damage
* [[llGetObjectDetails]] — Additional values around health, damage and type
** [[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]] — Apply damage to rezzed objects
** [[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
* [[llGetEnv]] — Several new values are added
* [[llGetEnv]] — Several new values are added
** "allow_damage_adjust" — Are scripts allowed to adjust damage
** "allow_damage_adjust" — Are scripts allowed to adjust damage
Line 66: Line 79:
** "health_regen_rate" — The speed of health regeneration in hitpoints 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
** "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)





Revision as of 10:19, 22 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 and be scanned by sensors
  • Combat Log has been added which allows for auditing
    • Records all damage events, damage adjustments and kills
    • System generated messages by a specific ID that scripts may 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:
      1. Teleport home (same as old LLCS)
      2. Teleport to region's telehub
      3. Teleport to parcel's landing point
      4. 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 function for rezzing objects with a variety of parameters, particularly useful for avoiding the overhead of starting a script for each bullet
• 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?)


Additional

  • llListen
    • Channel reserved at COMBAT_CHANNEL
    • System generated combat log messages sent by COMBAT_LOG_ID
    • Scripts may also write to this channel if the region allows it (see "restrict_combat_log" below)
  • llSensor — Scripts may filter by DAMAGEABLE for objects in world that process damage
  • llGetObjectDetails — Additional values around health, damage and type
  • llRezObjectWithParams — Apply damage to rezzed objects
    • 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
  • 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


Related