Difference between revisions of "Initiative Script"

From HLKitWiki
Jump to: navigation, search
(Technical Details)
 
(4 intermediate revisions by the same user not shown)
Line 12: Line 12:
 
|Fields Finalized?
 
|Fields Finalized?
 
|No
 
|No
 +
|-
 +
|Where Used:
 +
|[[Behavior Element (Data)|Definition File]]
 +
|-
 +
|Procedure Use:
 +
|None
 
|-
 
|-
 
|}
 
|}
Line 19: Line 25:
 
:{| class="infotable"
 
:{| class="infotable"
 
|class="leftnormal"|initiative
 
|class="leftnormal"|initiative
|(Number) Entry: The value zero.<br>
+
|(Number) Entry: The previous initiative value for the actor or zero if not yet specified.<br>
 
Exit: Calculated initiative value to use for the actor.
 
Exit: Calculated initiative value to use for the actor.
 
|-
 
|-
|secondary
+
|tiebreaker
|(Number) Entry: The value zero.<br>
+
|(Number) Entry: The previous tie-breaker value for the actor or zero if not yet specified.<br>
Exit: Calculated secondary initiative value (i.e. tie-breaker) to use for the actor.
+
Exit: Calculated tie-breaker initiative value to use for the actor.
 
|-
 
|-
 
|}
 
|}
Line 30: Line 36:
 
==Description==
 
==Description==
  
The Initiative script is used to generate appropriate initiative values for each actor. It is invoked whenever a new initiative value is needed, as determined by the configuration settings in the definition file.
+
The Initiative script is used to generate appropriate initiative values for each actor. It is invoked whenever a new initiative value is needed, as determined by the configuration settings in the definition file. It is always invoked after any NewCombat or NewTurn script is invoked.
  
There are two separate initiative values that must be generated. The first is the standard initiative value used for the game system. Once it is calculated, it should be assigned to the "initiative" special symbol. The second initiative value is the tie-breaker to be used if the two actors have the exact same primary initiative score. For example, in the d20 System, the dexterity bonus is used as a tie-breaker. This value should be assigned to the "secondary" special symbol.
+
There are two separate initiative values that must be generated. The first is the standard initiative value used for the game system. Once it is calculated, it should be assigned to the "initiative" special symbol. The second initiative value is the tie-breaker to be used if the two actors have the exact same primary initiative score. For example, in the d20 System, the dexterity bonus is used as a tie-breaker. This value should be assigned to the "tiebreaker" special symbol.
  
 
When invoked, the Initiative script starts with the "actor" pick of an actor in the combat as its initial context. From there, you can access whatever facets of the character are necessary to properly calculate the initiative scores.
 
When invoked, the Initiative script starts with the "actor" pick of an actor in the combat as its initial context. From there, you can access whatever facets of the character are necessary to properly calculate the initiative scores.
Line 44: Line 50:
 
@initiative = random(20) + 1 + hero.child[trInit].field[trtFinal].value
 
@initiative = random(20) + 1 + hero.child[trInit].field[trtFinal].value
 
~Tie-breaker is the dexterity bonus
 
~Tie-breaker is the dexterity bonus
@secondary = hero.child[attrDex].field[trtFinal].value
+
@tiebreaker = hero.child[attrDex].field[trtFinal].value
 
</pre>
 
</pre>

Latest revision as of 02:00, 20 February 2009

Context: HL KitKit Reference … Script Types 

Technical Details

Initial Context: Pick
Alternate Context: None
Fields Finalized? No
Where Used: Definition File
Procedure Use: None

The Initiative script utilizes the following special symbols:

initiative (Number) Entry: The previous initiative value for the actor or zero if not yet specified.

Exit: Calculated initiative value to use for the actor.

tiebreaker (Number) Entry: The previous tie-breaker value for the actor or zero if not yet specified.

Exit: Calculated tie-breaker initiative value to use for the actor.

Description

The Initiative script is used to generate appropriate initiative values for each actor. It is invoked whenever a new initiative value is needed, as determined by the configuration settings in the definition file. It is always invoked after any NewCombat or NewTurn script is invoked.

There are two separate initiative values that must be generated. The first is the standard initiative value used for the game system. Once it is calculated, it should be assigned to the "initiative" special symbol. The second initiative value is the tie-breaker to be used if the two actors have the exact same primary initiative score. For example, in the d20 System, the dexterity bonus is used as a tie-breaker. This value should be assigned to the "tiebreaker" special symbol.

When invoked, the Initiative script starts with the "actor" pick of an actor in the combat as its initial context. From there, you can access whatever facets of the character are necessary to properly calculate the initiative scores.

Example

In the d20 System, the initiative score is a d20 roll plus the initiative bonus, while the dexterity bonus is used as the tie-breaker. This yields a script that looks like the following.

~Initiative is a d20 roll (0 to 19 + 1) plus initiative bonus
@initiative = random(20) + 1 + hero.child[trInit].field[trtFinal].value
~Tie-breaker is the dexterity bonus
@tiebreaker = hero.child[attrDex].field[trtFinal].value