//::////////////////////////////////////////////////// //:: X0_CH_HEN_DEATH //:: Copyright (c) 2002 Floodgate Entertainment //::////////////////////////////////////////////////// /* OnDeath handler for henchmen ONLY. Causes them to respawn at (in order of preference) the respawn point of their master or their own starting location. */ //::////////////////////////////////////////////////// //:: Created By: Naomi Novik //:: Created On: 10/09/2002 //::////////////////////////////////////////////////// //::////////////////////////////////////////////////// //:: Modified By: Bob Minors //:: Modified On: Jan 12th, 2008 //:: Added Support for Dying While Mounted //:: Modified By: Deva Winblood //:: Modified On: April 17th, 2008 //:: Fixes for henchmen mounts being lost //::///////////////////////////////////////////////// #include "x0_i0_henchman" #include "x3_inc_horse" void BringBack(object oWP) { SetLocalObject(OBJECT_SELF,"NW_L_FORMERMASTER", GetMaster()); // : REMINDER: The delay is here for a reason DelayCommand(0.1, RemoveEffects(OBJECT_SELF)); DelayCommand(0.2, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), OBJECT_SELF)); DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(GetMaxHitPoints(OBJECT_SELF)), OBJECT_SELF)); DelayCommand(5.1, SetIsDestroyable(TRUE, TRUE, TRUE)); if (GetIsObjectValid(oWP) == TRUE) { // * if in Source stone area, respawn at opening to area // if (GetTag(GetArea(OBJECT_SELF)) == "SOME_RANDOM_AREA") // { DelayCommand(0.2, JumpToObject(oWP, FALSE)); // } // else // DelayCommand(0.2, JumpToObject(oWP, FALSE)); } else DelayCommand(0.3, ActionSpeakString("Error: No place to go")); } void main() { object oNPC = OBJECT_SELF; object oWP; string sResref = GetResRef(oNPC); if(sResref == "angus001") {oWP = GetObjectByTag("WP_HRESPAWN_ANGUS");} if(sResref == "bjorn") {oWP = GetObjectByTag("WP_HRESPAWN_BJORN");} if(sResref == "briah001") {oWP = GetObjectByTag("WP_HRESPAWN_BRIAH");} if(sResref == "hench_jeanmarie") {oWP = GetObjectByTag("WP_HRESPAWN_CHURCH");} if(sResref == "fabrizio001") {oWP = GetObjectByTag("WP_HRESPAWN_FAB");} if(sResref == "farouk") {oWP = GetObjectByTag("WP_HRESPAWN_FAROUK");} if(sResref == "francesco001") {oWP = GetObjectByTag("WP_HRESPAWN_FRANCESCO");} if(sResref == "frederic") {oWP = GetObjectByTag("WP_HRESPAWN_FREDERIC");} if(sResref == "gabrielle") {oWP = GetObjectByTag("WP_HRESPAWN_GABRIELLE");} if(sResref == "guillaume") {oWP = GetObjectByTag("WP_HRESPAWN_GUILL");} if(sResref == "isang") {oWP = GetObjectByTag("WP_HRESPAWN_ISANG");} if(sResref == "jacob001") {oWP = GetObjectByTag("WP_HRESPAWN_JACOB");} if(sResref == "kamen001") {oWP = GetObjectByTag("WP_HRESPAWN_KAMEN");} if(sResref == "kamiosa") {oWP = GetObjectByTag("WP_HRESPAWN_KAMIOSA");} if(sResref == "kerville") {oWP = GetObjectByTag("WP_HRESPAWN_KERVILLE");} if(sResref == "hench_marco") {oWP = GetObjectByTag("WP_HRESPAWN_MARCO");} if(sResref == "nephiliam") {oWP = GetObjectByTag("WP_HRESPAWN_NEPHILIAM");} if(sResref == "ug001") {oWP = GetObjectByTag("WP_HRESPAWN_UG");} SetLocalString(OBJECT_SELF,"sX3_DEATH_SCRIPT","x0_ch_hen_death"); if (HorseHandleDeath()) return; DeleteLocalString(OBJECT_SELF,"sX3_DEATH_SCRIPT"); // Handle a bunch of stuff to keep us from running around, // dying again, etc. PreRespawnSetup(); // Call for healing DelayCommand(0.5, VoiceHealMe(TRUE)); // Get our last master object oPC = GetLastMaster(); object oSelf = OBJECT_SELF; // Clear dialogue events ClearAllDialogue(oPC, OBJECT_SELF); ClearAllActions(); string sAreaTag = GetTag(GetArea(OBJECT_SELF)); // * in final battle area henchmen death is now permanent if (sAreaTag == "Winds_04") { SetPlotFlag(OBJECT_SELF,FALSE); SetImmortal(OBJECT_SELF, FALSE); SetIsDestroyable(TRUE, FALSE, FALSE); DestroyObject(OBJECT_SELF, 0.2); return; } if ((GetTag(GetModule()) == "MODULE" || GetTag(GetModule()) == "x0_module2" || GetTag(GetModule()) == "x0_module3") && GetIsObjectValid(oPC) == FALSE) { // SpawnScriptDebugger(); // * if you kill a henchmen who has never had a master // * then permanently kill them to prevent // * faction issues. SetPlotFlag(OBJECT_SELF,FALSE); SetImmortal(OBJECT_SELF, FALSE); SetIsDestroyable(TRUE, FALSE, FALSE); DestroyObject(OBJECT_SELF, 0.2); return; } // If we don't have a master OR he has died, respawn immediately // April 2003, in some areas the henchmen has to respawn immediately // back for pathfinding reasons (i.e., if they die in front of the dragon // the dragon will act stupid if (!GetIsObjectValid(oPC) || GetIsDead(oPC) == TRUE && GetTag(GetModule()) == "x0_module1" || sAreaTag =="Q5_DragonCaves" || sAreaTag == "Q3C_AncientTemple") { DelayCommand(1.0, RespawnHenchman()); DelayCommand(1.5, PostRespawnCleanup()); } else { // BK Feb 2003: Make the henchman rejoin you so that you can use potions on them DelayCommand(0.1, AddHenchman(oPC, oSelf)); // Start the respawn checking RaiseForRespawn(oPC); BringBack(oWP); SetCommandable(FALSE); // * henchmen will always stay where they die unless you leave them // RespawnCheck(oPC); } }