//Script Name: ////////////////////////////////////////// // Created By: Genisys (Guile) // Created On: 8/13/08 // // (TABASED ITEM SCRIPT TEMPLATE) ///////////////////////////////////////// /* This template is used for ALL events which happen for an item which has the same tagname as the name of this script. (You need to name this script the item's tagname) Every event below will fire when the event happens, ie. If the player activates the item the X2_ITEM_EVENT_ACTIVATE: script code will run. */ //////////////////////////////////////// #include "x2_inc_switches" //Main Script void main() { //All Major Variables Declared (Commonly used variables as well) int nEvent = GetUserDefinedItemEventNumber(); //Which event triggered this object oPC; //The player character using the item object oItem; //The item being used object oSpellOrigin; //The origin of the spell object oSpellTarget; //The target of the spell int iSpell; //The Spell ID number object oTarget; //Define oTarget below object oObject; //Define oObject below int nInt; //A commonly used intergal (Must be defined) int nLvl; //Commonly used intergal for levels (ie. GetHitDice(oTarget); etc.) string sTag; //Used to define a tagname of something string sResref; //Used to define a resref name of something string sMsg; //Used to define a message effect eEffect; //Used to define an effect to be applied to an object or location effect eVis; //Used to define a visual effect to be applied to an object or location location lTarget; //The Target Location of the PC ONLY! (USE - Getlocation(oPC);) location lway; //The Target location for the Activated Item's Target only! (See below) int nMax; //////////////////////////////////////////////////////////////////////////////////////////////// //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 done int nResult = X2_EXECUTE_SCRIPT_END; /////////////////////////////////////////////////////////////////////////////////////////////// //Deterimine which event has fired for the item... switch (nEvent) { /////////////////////////////////////////////////////////////////////////// /////////////Cast Spell: Unique Power /or/ Activate Item////////////////// //I seperated this cause it's more commonly used.. 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 only. oPC = GetItemActivator(); // The player who activated the item oItem = GetItemActivated(); // The item that was activated oTarget = GetItemActivatedTarget(); //The target of the item's power lway = GetItemActivatedTargetLocation(); //To get the location of the target! nMax = GetMaxHitPoints(oTarget); nInt = nMax -5; if(oTarget != oPC) { oTarget = GetItemActivatedTarget(); eEffect = EffectVisualEffect(VFX_FNF_IMPLOSION); ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectDamage(nInt, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY); ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget, 0.0f); oTarget = GetItemActivatedTarget(); eEffect = EffectVisualEffect(VFX_DUR_ICESKIN); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectBlindness(); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectKnockdown(); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 999.0f); oTarget = GetItemActivatedTarget(); eEffect = EffectMissChance(99, MISS_CHANCE_TYPE_NORMAL); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectStunned(); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectPolymorph(POLYMORPH_TYPE_SUCCUBUS, TRUE); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectPetrify(); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectSpellResistanceDecrease(60); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); oTarget = GetItemActivatedTarget(); eEffect = EffectSavingThrowDecrease(50, SAVING_THROW_TYPE_ALL); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget); } break; } //////////////////////////////////////////////////////////////////////////// //Case Statement End } //Pass the return value back to the calling script SetExecutedScriptReturnValue(nResult); }