Gear Script: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
New page: {{context|Kit Reference|Script Types}} ==Technical Details== :{| class="scripttable" |class="leftnormal"|Initial Context: |Pick |- |Alternate Context: |None |- |Fields F...
 
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
|Fields Finalized?
|Fields Finalized?
|No
|No
|-
|Where Used:
|[[Thing Element (Data)|Things]]
|-
|Procedure Use:
|None
|-
|-
|}
|}

Latest revision as of 08:41, 20 February 2009

Context: HL Kit … Kit Reference … Script Types 

Technical Details

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

The Eval script utilizes the following special symbols:

-None- There are no special symbols for a Gear script.

Description

The purpose of the Gear script is to let you apply non-standard behaviors to gear. By default, all gear that is placed within a holder has its weight accrued into the net weight of the holder. For example, if a backpack normally weighs 3 pounds and there is a potion inside the backpack that weighs 2 pounds, the net weight of the backpack will be 5 pounds. However, there are some items that break this rule. The classic example is the Bag of Holding from the d20 System, which weighs a fixed amount, regardless of what is stored within it. The Gear script allows you to override the standard behaviors and assign a custom weight to the holder.

The Gear script begins with an initial context of the pick itself. In the example above, the Gear script would start with the Bag of Holding as its initial context. From there, you can access other facets of the structural hierarchy if you need them. Upon entry to the script, the "gearHeld" field value has been automatically calculated to be the total weight of all items held within. In addition, the "gearNet" field value contains the net weight of the item, including the weight of both the item itself and its contents. By setting the values of these fields appropriately in the script, the appropriate weights will propagate up the containment hierarchy.

Example

We'll continue with the example of the Bag of Holding here. For this item, you would simply set the weight of the pick to be its basic weight, ignoring the accrued weight of its contents.

~Our contents count for no weight at all!
field[gearNet].value = field[gearWeight].value