Difference between revisions of "Cabal Common Library Doc OXPStrength"

From Elite Wiki
m (preparation for v1.7.1 - part I)
m
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
 +
{{OXPNote|The calculations will change for v1.7.1, resulting in more precise and higher values and faster processing time. The documentation reflects the current status of changes. By the time of writing only 1 OXP is affected (Vector)}}
 
This is the main class for the OXPStrength with its members and part of the [[Cabal_Common_Library]].
 
This is the main class for the OXPStrength with its members and part of the [[Cabal_Common_Library]].
  
It is a helper tool specially for mission OXPs to check the environment and helps to determine the players strength.
+
It is a helper tool specially for mission OXPs to check the environment and helps to determine the players strength. The script is meant for OXP developers only.
  
 
The underlaying API calculates a checksum (coef) for entities. This checksum can be gathered by scripts for specific entities (Player and NPCs). Factors are:
 
The underlaying API calculates a checksum (coef) for entities. This checksum can be gathered by scripts for specific entities (Player and NPCs). Factors are:
  
* accuracy (v1.7.1)
+
* Accuracy (v1.7.1)
 
* Distance to the hotspots (MainStation,WP and lanes WP,WS,PS)
 
* Distance to the hotspots (MainStation,WP and lanes WP,WS,PS)
 
* Equipment
 
* Equipment
* escorts / defense ships
+
* Escorts / Defense ships
 
* Laser
 
* Laser
* mass (v1.7.1)
+
* Mass (v1.7.1)
* maxEnergy
+
* MaxEnergy
* maxSpeed
+
* MaxSpeed
* maxThrust
+
* MaxThrust
* missiles
+
* Missiles
* primaryRole
+
* PrimaryRole
* shieldRechargeRates
+
* ShieldRechargeRates
 
* Subent laser
 
* Subent laser
* turrets
+
* Turrets
  
  
Line 25: Line 26:
 
=== checkPower() ===
 
=== checkPower() ===
 
{{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(entity,logging); }}
 
{{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(entity,logging); }}
Checks entities and returns the gathered coefficient.
+
Checks entities and returns the gathered coefficient. This is the main entry point for OXPs.
  
 
For NPCs the standard range is 0..192, but OXP entities can have a lot higher value based on their settings.
 
For NPCs the standard range is 0..192, but OXP entities can have a lot higher value based on their settings.
Playerships are treated different and are getting higher values. A standard Cobra MkIII has a value of 86 in the beginning and gets up to 293 if fully equipped with standard weaponry, missiles and other equipment. The Boa Class Cruiser even gets 304.
+
Playerships are treated different and are getting higher values. A standard Cobra MkIII has a value of 110 in the beginning and gets up to 307 if fully equipped with standard weaponry, missiles and other standard equipment. The Boa Class Cruiser even gets 314.
  
 
'''Parameters:'''
 
'''Parameters:'''
 
:;entity:Entity. If specified only this entity will be checked, otherwise all entities in the system (except the player).
 
:;entity:Entity. If specified only this entity will be checked, otherwise all entities in the system (except the player).
 
:: Optional.
 
:: Optional.
:;logging:Boolean. If true a verbose lits will be logged to Latest.log.
+
:;logging:Boolean. If true a verbose lits will be logged to Latest.log. This is useful while writing OXPs.
 
::Optional.
 
::Optional.
  
Line 50: Line 51:
  
 
* 1 = coef < 100
 
* 1 = coef < 100
* 2 = coef < 120
+
* 2 = coef < 200 - This is the default threshold for native Oolite NPCs if <tt>logging</tt> is used.
* 3 = coef < 150
+
* 3 = coef < 300
* 4 = coef < 180
+
* 4 = coef < 400
* 5 = coef < 200
+
* 5 = coef < 600
* 6 = coef < 300
+
* 6 = coef < 900
* 7 = coef < 500
+
* 7 = coef < 1000
* 8 = coef < 1000
+
* 8 = coef < 3000
* 9 = otherwise, default.
+
* 9 = otherwise, default setting for <tt>.CCL_OXPStrength</tt>.
  
  

Revision as of 12:15, 7 February 2013

Overview

This is the main class for the OXPStrength with its members and part of the Cabal_Common_Library.

It is a helper tool specially for mission OXPs to check the environment and helps to determine the players strength. The script is meant for OXP developers only.

The underlaying API calculates a checksum (coef) for entities. This checksum can be gathered by scripts for specific entities (Player and NPCs). Factors are:

  • Accuracy (v1.7.1)
  • Distance to the hotspots (MainStation,WP and lanes WP,WS,PS)
  • Equipment
  • Escorts / Defense ships
  • Laser
  • Mass (v1.7.1)
  • MaxEnergy
  • MaxSpeed
  • MaxThrust
  • Missiles
  • PrimaryRole
  • ShieldRechargeRates
  • Subent laser
  • Turrets


Functions

checkPower()

worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(entity,logging);

Checks entities and returns the gathered coefficient. This is the main entry point for OXPs.

For NPCs the standard range is 0..192, but OXP entities can have a lot higher value based on their settings. Playerships are treated different and are getting higher values. A standard Cobra MkIII has a value of 110 in the beginning and gets up to 307 if fully equipped with standard weaponry, missiles and other standard equipment. The Boa Class Cruiser even gets 314.

Parameters:

entity
Entity. If specified only this entity will be checked, otherwise all entities in the system (except the player).
Optional.
logging
Boolean. If true a verbose lits will be logged to Latest.log. This is useful while writing OXPs.
Optional.

Returns:

coef
Number. Calculated coefficient.
If entity was specified the value for this specific entity, otherwise the highest gathered coefficient in the system.


Properties

CCL_OXPStrength

The script can set a property to be used for strong entities.

worldScripts.Cabal_Common_OXPStrength.CCL_OXPStrength = 5;

Main purpose is to prevent the spawning by the populator. OXPs can use it in condition scripts. Default is 9.

Suggested classes:

  • 1 = coef < 100
  • 2 = coef < 200 - This is the default threshold for native Oolite NPCs if logging is used.
  • 3 = coef < 300
  • 4 = coef < 400
  • 5 = coef < 600
  • 6 = coef < 900
  • 7 = coef < 1000
  • 8 = coef < 3000
  • 9 = otherwise, default setting for .CCL_OXPStrength.


scriptInfo

ccl_missionShip

Missionships can also use a script_info key to indicate that this entity has to be handled with care by other scripts.

script_info = {ccl_missionShip = true;}