//////////////////////////////////////////////////////////////////////////// // Real Time Strategy - NWN - Custom Death (rts_mon_deathx) //========================================================================== // By Deva Bryson WInblood. 02/28/2003 // rewritten Jeremy Greene 06/14/2004 //////////////////////////////////////////////////////////////////////////// #include "nw_i0_plot" #include "x2_inc_itemprop" #include "rtsh_multiplay" #include "lib_hos1_xp" #include "prc_inc_racial" int fnSuitablePrey(object oPrey) { // return humanoids int nType=MyPRCGetRacialType(oPrey); if (nType==RACIAL_TYPE_DWARF) return TRUE; if (nType==RACIAL_TYPE_ELF) return TRUE; if (nType==RACIAL_TYPE_GNOME) return TRUE; if (nType==RACIAL_TYPE_HALFELF) return TRUE; if (nType==RACIAL_TYPE_HALFLING) return TRUE; if (nType==RACIAL_TYPE_HALFORC) return TRUE; if (nType==RACIAL_TYPE_HUMAN) return TRUE; if (nType==RACIAL_TYPE_FEY) return TRUE; if (nType==RACIAL_TYPE_HUMANOID_GOBLINOID) return TRUE; if (nType==RACIAL_TYPE_HUMANOID_MONSTROUS) return TRUE; if (nType==RACIAL_TYPE_HUMANOID_ORC) return TRUE; if (nType==RACIAL_TYPE_HUMANOID_REPTILIAN) return TRUE; return FALSE; } // fnSuitablePrey() void fnKilledByVampire() { // killed by a master vampire object oMe=OBJECT_SELF; object oKiller=GetLastKiller(); location lLoc=GetLocation(oMe); if (fnSuitablePrey(oMe)&&d4()==1&&GetLocalInt(oKiller,"nControlled")<2) // 25% chance { // valid to convert oMe=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_vamp_birth",lLoc,FALSE); SetLocalObject(oMe,"oMaster",oKiller); SetLocalInt(oKiller,"nControlled",GetLocalInt(oKiller,"nControlled")+1); } // valid to convert } // fnKilledByVampire() void fnKilledByGhoul() { // killed by ghoul ghast object oMe=OBJECT_SELF; object oNew; if (fnSuitablePrey(oMe)) { // Ghoul corpse oNew=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_corpse_eatme",GetLocation(oMe),FALSE); AssignCommand(oNew,SetFacing(GetFacing(OBJECT_SELF))); } // Ghoul corpse } // fnKilledByGhoul() void fnSpiderKilled() { // killed by spider object oMe=OBJECT_SELF; if (fnSuitablePrey(oMe)) { // cocoon oMe=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_cocoon",GetLocation(oMe),FALSE); AssignCommand(oMe,DelayCommand(HoursToSeconds(1),DestroyObject(oMe))); AssignCommand(oMe,DelayCommand(1.0,AssignCommand(oMe,SetFacing(GetFacing(OBJECT_SELF))))); } // cocoon } // fnSpiderKilled() void fnCheckForNearbyNecromancer() { // object oMe=OBJECT_SELF; object oNec=GetNearestObjectByTag("UND25",oMe); float fDist=GetDistanceBetween(oMe,oNec); int nMana; object oEffect; if (fDist!=0.0&&fDist<10.1&&fnSuitablePrey(oMe)) { // necromancer is within 10 meters nMana=GetLocalInt(oNec,"nMana"); if (nMana>0) { // plenty of mana arise nMana=nMana-1; SetLocalInt(oNec,"nMana",nMana); oEffect=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_animate_dead",GetLocation(oMe),FALSE); } // plenty of mana arise } // necromancer is within 10 meters } // fnCheckForNearbyNecromancer() void fnDeconsolidate(object oMe) { // deconsolidate int nC=1; object oF=GetLocalObject(oMe,"oConsolidated"+IntToString(nC)); while(oF!=OBJECT_INVALID) { // bring consolidated forces back out SetCommandable(TRUE,oF); SetAILevel(oF,AI_LEVEL_NORMAL); AssignCommand(oF,ClearAllActions()); AssignCommand(oF,JumpToObject(oMe)); SetLocalInt(oF,"nSState",0); DeleteLocalObject(oMe,"oConsolidated"+IntToString(nC)); nC++; oF=GetLocalObject(oMe,"oConsolidated"+IntToString(nC)); } // bring consolidated forces back out DeleteLocalInt(oMe,"bConsolidationLeader"); } // fnDeconsolidate() int fnHasSoul(object oTarget) { string sTag=GetTag(oTarget); if (sTag=="BAND"||sTag=="BANDA"||sTag=="Wizard"||sTag=="BANDCH"||sTag=="BANDCL"||sTag=="BANDM"||sTag=="BANDR"||sTag=="NW_GNOLL002"||sTag=="NW_WERERAT") return TRUE; if (GetLocalInt(GetModule(),sTag+"_soul")==1) return TRUE; return FALSE; } int fnIsCorpseDropper(object oMe) { // PURPOSE: Returns TRUE if this creature should drop a corpse int bRet=FALSE; int nRT=MyPRCGetRacialType(oMe); if (nRT==RACIAL_TYPE_HUMAN||nRT==RACIAL_TYPE_ELF||nRT==RACIAL_TYPE_HALFELF) bRet=TRUE; else if (nRT==RACIAL_TYPE_DWARF||nRT==RACIAL_TYPE_GNOME||nRT==RACIAL_TYPE_HALFLING) bRet=TRUE; else if (nRT==RACIAL_TYPE_HALFORC||nRT==RACIAL_TYPE_FEY||nRT==RACIAL_TYPE_HUMANOID_GOBLINOID||nRT==RACIAL_TYPE_HUMANOID_ORC) bRet=TRUE; return bRet; } // fnIsCorpseDropper() void fnJump(object oDest) { // PURPOSE: move object oMe=OBJECT_SELF; if (GetArea(oMe)!=GetArea(oDest)||GetDistanceBetween(oMe,oDest)>10.0) { // teleport AssignCommand(oMe,JumpToObject(oDest)); DelayCommand(0.5,fnJump(oDest)); } // teleport } // fnJump() void fnDropAll(object oNPC) { // PURPOSE: Drop all inventory object oItem; location lLoc=GetLocation(oNPC); oItem=GetFirstItemInInventory(oNPC); while(oItem!=OBJECT_INVALID) { // drop items not already set to droppable if (GetDroppableFlag(oItem)==FALSE) { // this item CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(1.0,DestroyObject(oItem)); } // this item oItem=GetNextItemInInventory(oNPC); } // drop items not already set to droppable oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oNPC); if (oItem!=OBJECT_INVALID&&GetDroppableFlag(oItem)==FALSE) { // drop it CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),lLoc); DelayCommand(0.5,DestroyObject(oItem)); } // drop it } // fnDropAll() void fnDestroyDrop(object oItem,location lLoc) { // PURPOSE: Destroy or drop string sTag; object oCopy; sTag=GetTag(oItem); sTag=GetStringUpperCase(sTag); if (GetStringLeft(sTag,4)=="RTS_"||GetPlotFlag(oItem)||GetResRef(oItem)=="soultoken") { // drop oCopy=CopyObject(oItem,lLoc); DestroyObject(oItem); } // drop else if (GetDroppableFlag(oItem)) DestroyObject(oItem); } // fnDestroyDrop() void fnDestroyNotFriendlyStuff(object oCreature) { // PURPOSE: Do not want to be able to kill own creatures for loot object oItem; oItem=GetItemInSlot(INVENTORY_SLOT_ARMS,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oCreature); if (GetIsObjectValid(oItem)) { // item exists fnDestroyDrop(oItem,GetLocation(oCreature)); } // item exists oItem=GetFirstItemInInventory(oCreature); while(GetIsObjectValid(oItem)) { // check items DelayCommand(0.03,fnDestroyDrop(oItem,GetLocation(oCreature))); oItem=GetNextItemInInventory(oCreature); } // check items } // fnDestroyNotFriendlyStuff() void main() { ExecuteScript("prc_npc_death", OBJECT_SELF); ExecuteScript("prc_pwondeath", OBJECT_SELF); object oMe=OBJECT_SELF; object oKiller = GetLastKiller(); int nKills=GetLocalInt(oKiller,"nKills"); string sKilledByTeam=GetLocalString(oKiller,"sTeamID"); object oLeader=GetLocalObject(GetModule(),"oTeamLead"+sKilledByTeam); object oMod=GetModule(); object oOb; float fCR; float fXPMultiplier; int nXP; string sTemp; int nN; object oCorpse; int bROTOO=GetLocalInt(oMod,"bROTOO"); int bDropSoulOkay=TRUE; string sS; string sMyID=GetLocalString(oMe,"sTeamID"); object oMyLeader; object oDamager=GetLastDamager(oMe); itemproperty ipProp; int nLevel; object oItem=GetObjectByTag("rts_it_op19"); if(GetIsObjectValid(oItem)) { // Death charm is in play oCorpse=GetItemPossessor(oItem); if (GetIsObjectValid(oCorpse)&&GetDistanceBetween(oCorpse,oMe)<=10.0) { // the charm is possessed if (GetItemInSlot(INVENTORY_SLOT_NECK,oCorpse)==oItem) { // target is wearing the charm SendMessageToPC(oCorpse,"The charm around your suddenly feels warm for a moment."); nN=fnGetTeamMana(oCorpse); nN++; fnSetTeamMana(oCorpse,nN); AdjustAlignment(oCorpse,ALIGNMENT_EVIL,1); } // target is wearing the charm } // the charm is possessed } // death charm is in play oItem=GetItemPossessedBy(oMe,"MANA_CRYSTAL_5"); if (GetIsObjectValid(oItem)) { // place mana pool DestroyObject(oItem); oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"strongmanapool",GetLocation(oMe)); } // place mana pool oItem=GetItemPossessedBy(oMe,"MANA_CRYSTAL_2"); if (GetIsObjectValid(oItem)) { // place mana pool DestroyObject(oItem); oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"manapool",GetLocation(oMe)); } // place mana pool oItem=GetItemPossessedBy(oMe,"MANA_CRYSTAL_1"); if (GetIsObjectValid(oItem)) { // place mana pool DestroyObject(oItem); oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"minormanapool",GetLocation(oMe)); } // place mana pool if (GetIsObjectValid(oDamager)) { // damager is valid oCorpse=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oDamager); if (GetIsObjectValid(oCorpse)&&GetTag(oCorpse)=="rts_it_op20") { // using soul harvest fCR=GetChallengeRating(oMe); nN=GetLocalInt(oCorpse,"nStoredCR"); nN=nN+FloatToInt(fCR); //FloatingTextStringOnCreature("Soul harvest absorbs "+IntToString(FloatToInt(fCR))+" for a total stored of "+IntToString(nN)+". Capable of reviving "+IntToString(nN/2)+" level character.",oDamager,FALSE); SetLocalInt(oCorpse,"nStoredCR",nN); ipProp=ItemPropertyVisualEffect(ITEM_VISUAL_EVIL); AddItemProperty(DURATION_TYPE_TEMPORARY,ipProp,oCorpse,5.0); } // using soul harvest } // damager is valid if (GetStringLength(sMyID)>0) { oMyLeader=GetLocalObject(GetModule(),"oTeamLead"+sMyID); } if (GetStringLength(sMyID)>0&&GetIsPC(oMyLeader)==FALSE) bDropSoulOkay=FALSE; if (GetLocalInt(oMe,"bConsolidationLeader")==TRUE) fnDeconsolidate(oMe); if (GetLocalInt(oMe,"nMState")==20) { // object oItem=GetFirstItemInInventory(oMe); while(oItem!=OBJECT_INVALID) { // !OI if (GetStringLeft(GetResRef(oItem),4)=="rts_") { // plot item oItem=CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),GetLocation(oMe),GetItemStackSize(oItem)); } // plot item oItem=GetNextItemInInventory(oMe); } // !OI } // // modify score // add to team deaths SetLocalInt(oMod,"nTeamDeaths"+GetLocalString(oMe,"sTeamID"),GetLocalInt(oMod,"nTeamDeaths"+GetLocalString(oMe,"sTeamID"))+1); // give killer a kill nKills++; SetLocalInt(oKiller,"nKills",nKills); if (GetMaster(oKiller)!=OBJECT_INVALID) { // killed by a summoned creature/familiar sKilledByTeam=GetLocalString(GetMaster(oKiller),"sTeamID"); if(sKilledByTeam!="") { // summoned creature's master is a teammember oLeader=GetLocalObject(GetModule(),"oTeamLead"+sKilledByTeam); nKills=GetLocalInt(GetMaster(oKiller),"nKills"); nKills++; SetLocalInt(GetMaster(oKiller),"nKills",nKills); } // summoned creature's master is a teammember } // killed by a summoned creature/familiar if(sKilledByTeam!="") { // add to team kills if killer has a team nKills=GetLocalInt(oMod,"nTeamKills"+sKilledByTeam); nKills++; SetLocalInt(oMod,"nTeamKills"+sKilledByTeam,nKills); // award XP to master of the killer nXP=GetXPValue(oKiller,oMe); if (GetIsPC(oKiller)) GiveXPToCreature(oKiller,nXP); if(GetStringLength(GetSubRace(oKiller))>0) { // sub-race if (nXP>0) nXP=FloatToInt(IntToFloat(nXP)*0.8); } // sub-race if (GetLocalInt(oKiller,"bChampion")) { // give champion experience SetLocalInt(oKiller,"nXP",GetLocalInt(oKiller,"nXP")+nXP); } // give champion experience if (oLeader!=OBJECT_INVALID&&GetIsPC(oKiller)==FALSE&&GetMaster(oKiller)!=oLeader) { // award xp for unit to leader if ((GetNearestObjectByTag(sKilledByTeam+"_START",oLeader,1)!=OBJECT_INVALID)||(GetIsObjectValid(GetLocalObject(oLeader,"oClone")))) { // only give XP to leader when they are in the lair int nLeaderXP; if (nXP>0) nLeaderXP=FloatToInt(IntToFloat(nXP)*0.25); if (nLeaderXP<1) nLeaderXP=1; GiveXPToCreature(oLeader,nLeaderXP); if (GetIsPC(oLeader)) SendMessageToPC(oLeader,GetName(oKiller)+" has given you "+IntToString(nLeaderXP)+" for a kill it made."); } // only give XP to leader when they are in the lair oOb=GetFirstPC(); while(GetIsObjectValid(oOb)) { // check for nearby PCs to award XP if(GetLocalString(oOb,"sTeamID")==sKilledByTeam) { // same team if (GetArea(oOb)==GetArea(oKiller)&&GetDistanceBetween(oKiller,oOb)<30.0) { // award some group XP nXP=nXP/3; if (nXP<1) nXP=1; GiveXPToCreature(oOb,nXP); } // award some group XP } // same team oOb=GetNextPC(); } // check for nearby PCs to award XP } // award xp for unit to leader else if (oLeader!=OBJECT_INVALID&&oKiller!=oLeader&&GetIsPC(oKiller)==TRUE) { // team member if (GetNearestObjectByTag(sKilledByTeam+"_START",oLeader,1)!=OBJECT_INVALID||GetLocalString(GetArea(oLeader),"sTeamID")==GetLocalString(oLeader,"sTeamID")) { // leader is in base if (GetGender(oLeader)==GENDER_MALE) sTemp="he"; else if(GetGender(oLeader)==GENDER_FEMALE) sTemp="she"; else sTemp="it"; SendMessageToPC(oKiller,"You have granted your leader XP while "+sTemp+" is in base."); SendMessageToPC(oLeader,"You are awarded XP while you are in base due to actions of '"+GetName(oKiller)+"'"); int nLeaderXP; if (nXP>0) nLeaderXP=FloatToInt(IntToFloat(nXP)*0.25); if (nLeaderXP<1) nLeaderXP=1; GiveXPToCreature(oLeader,nLeaderXP); } // leader is in base } // team member } if(GetTag(oMe)=="UND12") // vampire was killed, check to see if controlled by a master vamp { object oMaster=GetLocalObject(oMe,"oMaster"); if(oMaster!=OBJECT_INVALID) { SetLocalInt(oMaster,"nControlled",GetLocalInt(oMaster,"nControlled")-1); } } if (GetTag(oKiller)=="UND13") fnKilledByVampire(); else if (bROTOO==FALSE&&(GetTag(oKiller)=="UND3"||GetTag(oKiller)=="UND5"||GetTag(oKiller)=="UND11"||GetTag(oKiller)=="UND28")) fnKilledByGhoul(); else if (GetTag(oKiller)=="SPID14"||GetTag(oKiller)=="SPID15") fnSpiderKilled(); else if (bROTOO==FALSE) fnCheckForNearbyNecromancer(); // If a necromancer is nearby this might come back as a skeleton if((fnHasSoul(oMe)==TRUE&&bDropSoulOkay)||oMyLeader==oMe) { // drop a soul token CreateObject(OBJECT_TYPE_ITEM,"soultoken",GetLocation(oMe),TRUE); } // drop a soul token if (oMyLeader!=oMe&&bROTOO&&fnIsCorpseDropper(oMe)&&sMyID!=GetLocalString(oKiller,"sTeamID")) { // all non-leaders drop all goodies oCorpse=CreateObject(OBJECT_TYPE_PLACEABLE,"corpseres",GetLocation(oMe)); SetLocalString(oCorpse,"sRes",GetResRef(oMe)); nLevel=GetLevelByPosition(1,oMe)+GetLevelByPosition(2,oMe)+GetLevelByPosition(3,oMe); nN=5; if (nLevel<3) nN=1; else if (nLevel<6) nN=2; else if (nLevel<9) nN=3; else if (nLevel<12) nN=4; SetLocalInt(oCorpse,"nLevel",nN); SetLocalInt(oCorpse,"nOLevel",nN); SetLocalString(oCorpse,"sKN",GetName(oKiller)); SetLocalObject(oCorpse,"oAK",GetArea(oCorpse)); DelayCommand(1.0,fnDropAll(oMe)); DelayCommand(3.0,DestroyObject(oMe)); } // all non-leaders drop all goodies else if (sMyID==GetLocalString(oKiller,"sTeamID")&&GetStringLength(sMyID)>0) { // don't let kill own people for loot fnDestroyNotFriendlyStuff(oMe); } // don't let kill own people for loot if (oMyLeader==oMe&&GetLocalInt(oMod,"bAIPCLeaderType")) { // this is an AI leader and needs to be kept alive oKiller=GetWaypointByTag("NW_DEATH_TEMPLE_"+IntToString(d4())); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oMe); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oMe)), oMe); RemoveEffects(oMe); SetAILevel(oMe,AI_LEVEL_NORMAL); fnJump(oKiller); DeleteLocalInt(oMe,"nState"); DeleteLocalInt(oMe,"nPathPosition_EXP"); DeleteLocalInt(oMe,"nPathPosition_CON"); DeleteLocalInt(oMe,"nPathPosition_ASS"); DeleteLocalInt(oMe,"nPathPosition_ESC"); DeleteLocalObject(oMe,"oDestWP"); DeleteLocalObject(oMe,"oPathDest"); DeleteLocalInt(oMe,"nMode"); } // this is an AI leader and needs to be kept alive if (GetStringLength(GetLocalString(oMe,"sDeathScript"))>0) ExecuteScript(GetLocalString(oMe,"sDeathScript"),oMe); }