Difference between revisions of "Modding:ItemSet"

From DoomRL Wiki

Jump to: navigation, search
m (sid fix)
m (anchor fixes)
 
Line 30: Line 30:
  
 
----
 
----
{{Anchor|item_OnEquip}}
+
{{Anchor|itemset_OnEquip}}
 
;OnEquip([[Modding:Item|Item]] self, [[Modding:Being|Being]] equipper)  
 
;OnEquip([[Modding:Item|Item]] self, [[Modding:Being|Being]] equipper)  
 
:This hook is called when the item is equipped in any equipment slot. It is only added to items of the item set if ''trigger''-1 items have already been equipped (that is, all set items but one).
 
:This hook is called when the item is equipped in any equipment slot. It is only added to items of the item set if ''trigger''-1 items have already been equipped (that is, all set items but one).
 
----
 
----
{{Anchor|item_OnRemove}}
+
{{Anchor|itemset_OnRemove}}
 
;OnRemove([[Modding:Item|Item]] self, [[Modding:Being|Being]] wearer)  
 
;OnRemove([[Modding:Item|Item]] self, [[Modding:Being|Being]] wearer)  
 
:This hook is called when a being unequips the item, or when the item is otherwise removed from the being's equipment. This includes armor being destroyed by damage. It is only added to items of the item set if ''trigger'' items have been equipped (that is, the entire set).
 
:This hook is called when a being unequips the item, or when the item is otherwise removed from the being's equipment. This includes armor being destroyed by damage. It is only added to items of the item set if ''trigger'' items have been equipped (that is, the entire set).

Latest revision as of 23:52, 27 January 2012

Along with items are the possibility to form sets with certain items. These are formed with the ItemSet object and can be created to produce unique possibilities with gear.

Prototype

The ItemSet prototype is fairly small, because almost all of the importance of an item set lies in its engine hooks. The prototype keys are merely there to make sure that such hooks are trigger at the appropriate time.

ItemSet Prototype
string name This is the item's name. Currently it has no use.
string id This is the item's sid. It must be distinct from other string ids. (The numeric id is automatically generated and stored in the nid field of the prototype.) It defaults to the first word of the name in all lowercase.
integer trigger This value determines how many items must be equipped before the set bonus can be added.

Engine Hooks

ItemSet hooks are not always triggered: instead, they rely on the number of set items currently equipped.

ItemSet Hooks
void OnEquip(Item self, Being equipper)
void OnRemove(Item self, Being wearer)

OnEquip(Item self, Being equipper)
This hook is called when the item is equipped in any equipment slot. It is only added to items of the item set if trigger-1 items have already been equipped (that is, all set items but one).

OnRemove(Item self, Being wearer)
This hook is called when a being unequips the item, or when the item is otherwise removed from the being's equipment. This includes armor being destroyed by damage. It is only added to items of the item set if trigger items have been equipped (that is, the entire set).
Personal tools