//:://///////////////////////////////////////////// //:: Name x2_def_ondamage //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Default OnDamaged script */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: June 11/03 //::////////////////////////////////////////////// #include "color_header" void main() { object oDamager=GetLastDamager(); object oMe=OBJECT_SELF; object oCaster=GetLastSpellCaster(); object oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oDamager); int nType=GetBaseItemType(oItem); int nReflex; int nRoll; object oDrop; string sMsg; effect eE; if (nType!=BASE_ITEM_GRENADE&&nType!=BASE_ITEM_DART&&nType!=BASE_ITEM_LIGHTCROSSBOW&&nType!=BASE_ITEM_LONGBOW&&nType!=BASE_ITEM_SHORTBOW&&nType!=BASE_ITEM_HEAVYCROSSBOW&&nType!=BASE_ITEM_SHURIKEN&&nType!=BASE_ITEM_SLING&&nType!=BASE_ITEM_THROWINGAXE) { // not a missile weapon if (GetDistanceBetween(oMe,oDamager)<3.0) { // in range if (oItem!=OBJECT_INVALID&&oCaster!=oDamager) { // see if weapon stuck nReflex=GetReflexSavingThrow(oDamager); nRoll=d20(); if (nRoll+nReflex<14) { // failed sMsg="These things are sticky!! You failed reflex roll "+IntToString(nRoll)+"+"+IntToString(nReflex)+"="+IntToString(nRoll+nReflex)+" which does not beat the DC14."; sMsg=ColorRGBString(sMsg,6,3,3); SendMessageToPC(oDamager,sMsg); nRoll=GetItemCharges(oItem); oDrop=CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),GetLocation(oMe)); nReflex=GetItemCharges(oDrop); if (nRoll!=nReflex) SetItemCharges(oDrop,nRoll); DestroyObject(oItem); } // failed } // see if weapon stuck else if (oItem==OBJECT_INVALID&&oCaster!=oDamager) { // see if grappled nReflex=GetReflexSavingThrow(oDamager); nRoll=d20(); if (nRoll+nReflex<14) { // failed sMsg="These things are sticky!! You failed reflex roll "+IntToString(nRoll)+"+"+IntToString(nReflex)+"="+IntToString(nRoll+nReflex)+" which does not beat the DC14."; sMsg=ColorRGBString(sMsg,6,3,3); SendMessageToPC(oDamager,sMsg); eE=EffectEntangle(); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eE,oDamager,12.0); } // failed } // see if grappled } // in range } // not a missile weapon //-------------------------------------------------------------------------- // GZ: 2003-10-16 // Make Plot Creatures Ignore Attacks //-------------------------------------------------------------------------- if (GetPlotFlag(OBJECT_SELF)) { return; } //-------------------------------------------------------------------------- // Execute old NWN default AI code //-------------------------------------------------------------------------- ExecuteScript("nw_c2_default6", OBJECT_SELF); }