//:://///////////////////////////////////////////// //:: Name x2_def_ondamage //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Default OnDamaged script */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: June 11/03 //::////////////////////////////////////////////// void main() { object oWP; object oMe=OBJECT_SELF; object oDamager=GetLastDamager(); int nN; int nType=0; int nLast; string sRes="syphon"; object oSyphon; int bFound=FALSE; nLast=GetLocalInt(oMe,"nAcid"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_ACID)) { // not match nType=1; SetLocalInt(oMe,"nAcid",GetDamageDealtByType(DAMAGE_TYPE_ACID)); } // not match nLast=GetLocalInt(oMe,"nBase"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_BASE_WEAPON)) { // not match nType=2; SetLocalInt(oMe,"nBase",GetDamageDealtByType(DAMAGE_TYPE_BASE_WEAPON)); } // not match nLast=GetLocalInt(oMe,"nBludgeon"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_BLUDGEONING)) { // not match nType=3; SetLocalInt(oMe,"nBludgeon",GetDamageDealtByType(DAMAGE_TYPE_BLUDGEONING)); } // not match nLast=GetLocalInt(oMe,"nCold"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_COLD)) { // not match nType=4; SetLocalInt(oMe,"nCold",GetDamageDealtByType(DAMAGE_TYPE_COLD)); } // not match nLast=GetLocalInt(oMe,"nDivine"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_DIVINE)) { // not match nType=5; SetLocalInt(oMe,"nDivine",GetDamageDealtByType(DAMAGE_TYPE_DIVINE)); } // not match nLast=GetLocalInt(oMe,"nElec"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_ELECTRICAL)) { // not match nType=6; SetLocalInt(oMe,"nElec",GetDamageDealtByType(DAMAGE_TYPE_ELECTRICAL)); } // not match nLast=GetLocalInt(oMe,"nFire"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_FIRE)) { // not match nType=7; SetLocalInt(oMe,"nFire",GetDamageDealtByType(DAMAGE_TYPE_FIRE)); } // not match nLast=GetLocalInt(oMe,"nMagical"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_MAGICAL)) { // not match nType=8; SetLocalInt(oMe,"nMagical",GetDamageDealtByType(DAMAGE_TYPE_MAGICAL)); } // not match nLast=GetLocalInt(oMe,"nNegative"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_NEGATIVE)) { // not match nType=9; SetLocalInt(oMe,"nNegative",GetDamageDealtByType(DAMAGE_TYPE_NEGATIVE)); } // not match nLast=GetLocalInt(oMe,"nPiercing"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_PIERCING)) { // not match nType=10; SetLocalInt(oMe,"nPiercing",GetDamageDealtByType(DAMAGE_TYPE_PIERCING)); } // not match nLast=GetLocalInt(oMe,"nPositive"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_POSITIVE)) { // not match nType=11; SetLocalInt(oMe,"nPositive",GetDamageDealtByType(DAMAGE_TYPE_POSITIVE)); } // not match nLast=GetLocalInt(oMe,"nSlashing"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_SLASHING)) { // not match nType=12; SetLocalInt(oMe,"nSlashing",GetDamageDealtByType(DAMAGE_TYPE_SLASHING)); } // not match nLast=GetLocalInt(oMe,"nSonic"); if (nLast!=GetDamageDealtByType(DAMAGE_TYPE_SONIC)) { // not match nType=1; SetLocalInt(oMe,"nSonic",GetDamageDealtByType(DAMAGE_TYPE_SONIC)); } // not match if (nType!=0) { // create a syphon nN=1; oWP=GetNearestObjectByTag("SYPHON_SPAWN",oMe,nN); while(oWP!=OBJECT_INVALID&&!bFound) { // find spawn location oSyphon=GetNearestObjectByTag("SYPHON",oWP,1); if (oSyphon==OBJECT_INVALID||GetDistanceBetween(oSyphon,oWP)>3.0) bFound=TRUE; else { nN++; oWP=GetNearestObjectByTag("SYPHON_SPAWN",oMe,nN); } } // find spawn location if (bFound) { // spawn location found nN=1; oSyphon=GetNearestObjectByTag("SYPHON",oMe,nN); while(oSyphon!=OBJECT_INVALID&&bFound) { // make sure this damage type is not already created if (GetLocalInt(oSyphon,"nType")==nType) bFound=FALSE; nN++; oSyphon=GetNearestObjectByTag("SYPHON",oMe,nN); } // make sure this damage type is not already created if (bFound) { // okay to create a syphon oSyphon=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP)); SetLocalObject(oSyphon,"oMother",oMe); SetLocalInt(oSyphon,"nType",nType); } // okay to create a syphon } // spawn location found } // create a syphon //-------------------------------------------------------------------------- // 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); }