Difference between revisions of "OnEquip"
Jump to navigation
Jump to search
imported>Quetzilla m (formatting) |
imported>Haama (→Notes: This doesn't require returning to GameMode) |
||
Line 10: | Line 10: | ||
* This block '''''will''''' run when a non-equippable item is selected (left-clicked) in the inventory menu. Note that a message appears in the upper left corner of the screen: "This item cannot be equipped." | * This block '''''will''''' run when a non-equippable item is selected (left-clicked) in the inventory menu. Note that a message appears in the upper left corner of the screen: "This item cannot be equipped." | ||
** You can make this message blank by replacing the game setting [[sCantEquipGeneric]] with a space. The blank message will still be displayed, and will cause the normal delay to other messages, but no text will appear. Don't delete the string completely - it can prevent other messages from displaying. | ** You can make this message blank by replacing the game setting [[sCantEquipGeneric]] with a space. The blank message will still be displayed, and will cause the normal delay to other messages, but no text will appear. Don't delete the string completely - it can prevent other messages from displaying. | ||
* This block '''''will not''''' run when potions, poisons, or ingredients are consumed by the player. Instead, use [[ | * This block '''''will not''''' run when potions, poisons, or ingredients are consumed by the player. Instead, use a [[MenuMode]] block inside a script effect for the item. | ||
* This block '''''will not''''' run when an item is equipped via script using the [[EquipItem]] function. However, an [[onUnequip]] block '''''will''''' run when the object is unequipped using [[unequipItem]]. This means that scripted enchantments that are added and removed using these two block types can malfunction if the item is equipped and unequipped via script. | * This block '''''will not''''' run when an item is equipped via script using the [[EquipItem]] function. However, an [[onUnequip]] block '''''will''''' run when the object is unequipped using [[unequipItem]]. This means that scripted enchantments that are added and removed using these two block types can malfunction if the item is equipped and unequipped via script. | ||
[[Category: Blocktypes]] | [[Category: Blocktypes]] |
Revision as of 12:27, 23 June 2008
Syntax:
begin OnEquip ActorID
Example:
begin OnEquip begin OnEquip player
This block will be run once when the scripted object is equipped by the specified Actor. If no parameter is used, the block will be run whenever the object is equipped by any actor.
Notes
- This block will run when a non-equippable item is selected (left-clicked) in the inventory menu. Note that a message appears in the upper left corner of the screen: "This item cannot be equipped."
- You can make this message blank by replacing the game setting sCantEquipGeneric with a space. The blank message will still be displayed, and will cause the normal delay to other messages, but no text will appear. Don't delete the string completely - it can prevent other messages from displaying.
- This block will not run when potions, poisons, or ingredients are consumed by the player. Instead, use a MenuMode block inside a script effect for the item.
- This block will not run when an item is equipped via script using the EquipItem function. However, an onUnequip block will run when the object is unequipped using unequipItem. This means that scripted enchantments that are added and removed using these two block types can malfunction if the item is equipped and unequipped via script.