Gear Script

From HLKitWiki
Revision as of 01:08, 14 December 2008 by Rob (talk | contribs) (New page: {{context|Kit Reference|Script Types}} ==Technical Details== :{| class="scripttable" |class="leftnormal"|Initial Context: |Pick |- |Alternate Context: |None |- |Fields F...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … Script Types 

Technical Details

Initial Context: Pick
Alternate Context: None
Fields Finalized? No

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