//:://////////////////////////////////////////////////////////////////////////////:: SCRIPT PURPOSE//:://///////////////////////////////////////////////////////////////////////////* Tag based item event handler script*///:://////////////////////////////////////////////////////////////////////////////:: Item Name://:: Item Tag://:: Item ResRef://:://////////////////////////////////////////////////////////////////////////////:://////////////////////////////////////////////////////////////////////////////:: Script Name://:: Created By: Morikahn//:: Created On://:: Modfied On://:://///////////////////////////////////////////////////////////////////////////* This script is inteneded to funtion with HOTU item tagged based scripting. Its name has a prefix of "i_" which is the naming convention used on Narfell. If this script ends up on another server, make sure to alter the script name to match your server's naming conventin for tag based scripting.*///:: INCLUDE ///////////////////////////////////////////////////////////////////#include "x2_inc_switches"//:: MAIN //////////////////////////////////////////////////////////////////////void main(){int nEvent = GetUserDefinedItemEventNumber(); //Which event triggered thisobject oPC; //The player character using the itemobject oItem; //The item being usedobject oSpellOrigin; //The origin of the spellobject oSpellTarget; //The target of the spellint iSpell; //The Spell ID number//Set the return value for the item event script// * X2_EXECUTE_SCRIPT_CONTINUE - continue calling script after executed script is done// * X2_EXECUTE_SCRIPT_END - end calling script after executed script is doneint nResult = X2_EXECUTE_SCRIPT_END;switch (nEvent){case X2_ITEM_EVENT_ONHITCAST:// * This code runs when the item has the 'OnHitCastSpell: Unique power' property// * and it hits a target(if it is a weapon) or is being hit (if it is a piece of armor)// * Note that this event fires for non PC creatures as well.oItem = GetSpellCastItem(); // The item triggering this spellscriptoPC = OBJECT_SELF; // The player triggering itoSpellOrigin = OBJECT_SELF ; // Where the spell came fromoSpellTarget = GetSpellTargetObject(); // What the spell is aimed at//Your code goes herebreak;case X2_ITEM_EVENT_ACTIVATE:// * This code runs when the Unique Power property of the item is used or the item// * is activated. Note that this event fires for PCs onlyoPC = GetItemActivator(); // The player who activated the itemoItem = GetItemActivated(); // The item that was activated//Your code goes herebreak;case X2_ITEM_EVENT_EQUIP:// * This code runs when the item is equipped// * Note that this event fires for PCs onlyoPC = GetPCItemLastEquippedBy(); // The player who equipped the itemoItem = GetPCItemLastEquipped(); // The item that was equipped//Your code goes herebreak;case X2_ITEM_EVENT_UNEQUIP:// * This code runs when the item is unequipped// * Note that this event fires for PCs onlyoPC = GetPCItemLastUnequippedBy(); // The player who unequipped the itemoItem = GetPCItemLastUnequipped(); // The item that was unequipped//Your code goes herebreak;case X2_ITEM_EVENT_ACQUIRE:// * This code runs when the item is acquired// * Note that this event fires for PCs onlyoPC = GetModuleItemAcquiredBy(); // The player who acquired the itemoItem = GetModuleItemAcquired(); // The item that was acquired//Your code goes herebreak;case X2_ITEM_EVENT_UNACQUIRE:// * This code runs when the item is unacquired// * Note that this event fires for PCs onlyoPC = GetModuleItemLostBy(); // The player who dropped the itemoItem = GetModuleItemLost(); // The item that was dropped//Your code goes herebreak;case X2_ITEM_EVENT_SPELLCAST_AT://* This code runs when a PC or DM casts a spell from one of the//* standard spellbooks on the itemoPC = OBJECT_SELF; // The player who cast the spelloItem = GetSpellTargetObject(); // The item targeted by the spelliSpell = GetSpellId(); // The id of the spell that was cast// See the list of SPELL_* constants//Your code goes here//Change the following line from X2_EXECUTE_SCRIPT_CONTINUE to//X2_EXECUTE_SCRIPT_END if you want to prevent the spell that was//cast on the item from taking effectnResult = X2_EXECUTE_SCRIPT_CONTINUE;break;}//Pass the return value back to the calling scriptSetExecutedScriptReturnValue(nResult);}