//:://///////////////////////////////////////////// //:: User Defined OnHitCastSpell code //:: x2_s3_onhitcast //:: Copyright (c) 2003 Bioware Corp. //::////////////////////////////////////////////// /* This file can hold your module specific OnHitCastSpell definitions How to use: - Add the Item Property OnHitCastSpell: UniquePower (OnHit) - Add code to this spellscript (see below) WARNING! This item property can be a major performance hog when used extensively in a multi player module. Especially in higher levels, with each player having multiple attacks, having numerous of OnHitCastSpell items in your module this can be a problem. It is always a good idea to keep any code in this script as optimized as possible. */ //::////////////////////////////////////////////// //:: Created By: Georg Zoeller //:: Created On: 2003-07-22 //::////////////////////////////////////////////// #include "x2_inc_switches" #include "dcy_include" void main() { object oItem; // The item casting triggering this spellscript object oSpellTarget; // On a weapon: The one being hit. On an armor: The one hitting the armor object oSpellOrigin; // On a weapon: The one wielding the weapon. On an armor: The one wearing an armor // fill the variables oSpellOrigin = OBJECT_SELF; oSpellTarget = GetSpellTargetObject(); oItem = GetSpellCastItem(); if (GetIsObjectValid(oItem)) { int iType = GetBaseItemType(oItem); // Resident Evil Online Durability System - Handles reducing an armor's durability level if(iType == BASE_ITEM_ARMOR) { object oBelt = GetItemInSlot(INVENTORY_SLOT_BELT, oSpellOrigin); // Check if armor is equipped (REO uses belts as armor) if(GetIsObjectValid(oBelt)) { DCY_RunItemDecay(oSpellOrigin, oBelt, 3, Random(2), TRUE); } } // * Generic Item Script Execution Code // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module, // * it will execute a script that has the same name as the item's tag // * inside this script you can manage scripts for all events by checking against // * GetUserDefinedItemEventNumber(). See x2_it_example.nss if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE) { SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ONHITCAST); int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF); if (nRet == X2_EXECUTE_SCRIPT_END) { return; } } } }