#include "x0_i0_henchman" void BringBack(object oNPC, object oWP) { SetLocalObject(oNPC, "NW_L_FORMERMASTER", GetMaster()); // Ensure effects are removed before resurrection. DelayCommand(0.1, RemoveEffects(oNPC)); DelayCommand(0.2, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), oNPC)); DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(GetMaxHitPoints(oNPC)), oNPC)); DelayCommand(5.1, SetIsDestroyable(TRUE, TRUE, TRUE)); // Check if the waypoint is valid if (GetIsObjectValid(oWP)) { // Execute JumpToObject slightly later to allow effects to process. DelayCommand(0.5, JumpToObject(oWP, FALSE)); } else { DelayCommand(0.5, ActionSpeakString("Error: No place to go")); } } void main() { object oNPC = OBJECT_SELF; object oWP; string sResref = GetResRef(oNPC); // Use GetWaypointByTag for better clarity if (sResref == "angus001") { oWP = GetWaypointByTag("WP_HRESPAWN_ANGUS"); } if (sResref == "bjorn") { oWP = GetWaypointByTag("WP_HRESPAWN_BJORN"); } if (sResref == "briah001") { oWP = GetWaypointByTag("WP_HRESPAWN_BRIAH"); } if (sResref == "hench_jeanmarie") { oWP = GetWaypointByTag("WP_HRESPAWN_CHURCH"); } if (sResref == "fabrizio001") { oWP = GetWaypointByTag("WP_HRESPAWN_FAB"); } if (sResref == "farouk") { oWP = GetWaypointByTag("WP_HRESPAWN_FAROUK"); } if (sResref == "francesco001") { oWP = GetWaypointByTag("WP_HRESPAWN_FRANCESCO"); } if (sResref == "frederic") { oWP = GetWaypointByTag("WP_HRESPAWN_FREDERIC"); } if (sResref == "gabrielle") { oWP = GetWaypointByTag("WP_HRESPAWN_GABRIELLE"); } if (sResref == "guillaume") { oWP = GetWaypointByTag("WP_HRESPAWN_GUILL"); } if (sResref == "isang") { oWP = GetWaypointByTag("WP_HRESPAWN_ISANG"); } if (sResref == "jacob001") { oWP = GetWaypointByTag("WP_HRESPAWN_JACOB"); } if (sResref == "kamen001") { oWP = GetWaypointByTag("WP_HRESPAWN_KAMEN"); } if (sResref == "kamiosa") { oWP = GetWaypointByTag("WP_HRESPAWN_KAMIOSA"); } if (sResref == "kerville") { oWP = GetWaypointByTag("WP_HRESPAWN_KERVILLE"); } if (sResref == "hench_marco") { oWP = GetWaypointByTag("WP_HRESPAWN_MARCO"); } if (sResref == "nephiliam") { oWP = GetWaypointByTag("WP_HRESPAWN_NEPHILIAM"); } if (sResref == "ug001") { oWP = GetWaypointByTag("WP_HRESPAWN_UG"); } PlayVoiceChat(VOICE_CHAT_GOODBYE); FireHenchman(GetMaster(oNPC), oNPC); // Call BringBack with both oNPC and oWP BringBack(oNPC, oWP); }