EN4_PRC8/_module/nss/en3_henchdeath.nss
Jaysyn904 b464d8da05 Initial Commit
Initial Commit [v1.32PRC8]
2025-04-03 13:38:45 -04:00

120 lines
3.4 KiB
Plaintext

#include "nw_i0_generic"
#include "nw_i0_plot"
#include "rd_misc"
//#include "x0_i0_henchman"
void WrapJump(string sTarget);
void main()
{
object oSelf = OBJECT_SELF;
RemoveEffects(oSelf);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(GetMaxHitPoints(OBJECT_SELF)), OBJECT_SELF);
string sDestTag = "NH_Respawn";
string sArea;
sArea = GetZone(oSelf);
if (sArea == "NH1")
{
sDestTag = "NH_Respawn";
}
if (sArea == "MH1" || sArea == "MHC")
{
sDestTag = "en3_church";
}
if (sArea == "SF1" || sArea == "SFT")
{
sDestTag = "en3_shack";
}
if (sArea == "SP1" || sArea == "MC1")
{
sDestTag = "SP_Respawn";
}
if (sArea == "GD1" || sArea == "EF1")
{
sDestTag = "EF_Respawn";
}
object oWay = GetObjectByTag(sDestTag);
if (GetIsObjectValid(oWay) == TRUE)
{
DelayCommand(1.0, WrapJump(GetTag(oWay)));
} else {
WriteTimestampedLogEntry("UT: No place to go");
}
/* Old Code
object oSpawnPoint;
if (GetAssociateType(OBJECT_SELF) == ASSOCIATE_TYPE_HENCHMAN)
{
SendMessageToPC(GetMaster(),"Henchman respawing at Church of Light");
SetLocalInt(OBJECT_SELF, "X2_L_IJUSTDIED", 10);
SetKilled(GetMaster());
SetDidDie();
object oHench = OBJECT_SELF;
// * Take them out of stealth mode too (Nov 1 - BK)
SetActionMode(oHench, ACTION_MODE_STEALTH, FALSE);
// * Remove invisibility type effects off of henchmen (Nov 7 - BK)
RemoveSpellEffects(SPELL_INVISIBILITY, oHench, oHench);
RemoveSpellEffects(SPELL_IMPROVED_INVISIBILITY, oHench, oHench);
RemoveSpellEffects(SPELL_SANCTUARY, oHench, oHench);
RemoveSpellEffects(SPELL_ETHEREALNESS, oHench, oHench);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oHench);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oHench)), oHench);
RemoveEffects(oHench);
oSpawnPoint = GetObjectByTag("en3_church");
AssignCommand(oHench,JumpToLocation(GetLocation(oSpawnPoint)));
}
RemoveHenchman(GetMaster(), OBJECT_SELF);
*/
}
void WrapJump(string sTarget)
{
if (GetIsDead(OBJECT_SELF))
{
// * Resurrect and heal again, just in case
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(GetMaxHitPoints(OBJECT_SELF)), OBJECT_SELF);
// * recursively call self until we are alive again
DelayCommand(1.0f,WrapJump( sTarget));
return;
}
// * since the henchmen are teleporting very fast now, we leave a bloodstain on the ground
object oBlood = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_bloodstain", GetLocation(OBJECT_SELF));
// * Remove blood after a while
DestroyObject(oBlood,30.0f);
// * Ensure the action queue is open to modification again
SetCommandable(TRUE,OBJECT_SELF);
// * Jump to Target
JumpToObject(GetObjectByTag(sTarget), FALSE);
// * Unset busy state
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY, FALSE));
// * Make self vulnerable
SetPlotFlag(OBJECT_SELF, FALSE);
// * Set destroyable flag to leave corpse
DelayCommand(6.0f, SetIsDestroyable(TRUE, TRUE, TRUE));
}