Rune_PRC8/_module/nss/res_onrespawn.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

102 lines
3.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name: Respawn Script
//:: FileName: res_onrespawn
//:://////////////////////////////////////////////
/*
Place this script in the Module's OnRespawn Event
See the res_readme script for more instructions
This is based on Moeb's Respawn_System
Available from NWVault.
It has been extensively modified to simplify
and more fully explain and comment the script.
Hope you like it.
*/
//:://////////////////////////////////////////////
//:: Created By: Dezran
//:: Created On: 11/25/02
//:://////////////////////////////////////////////
void main()
{
// Set up Variables
object oPC, oHeav, oHell, oPurg;
string sKiller;
location lHeav, lHell, lPurg, lDeath;
effect eHell, ePurg, eHeav;
// Get the PC when he presses the Respawn Button
oPC = GetLastRespawnButtonPresser();
// Set all the Waypoints
oHeav = GetWaypointByTag("WP_HEAVEN");
oHell = GetWaypointByTag("WP_HELL");
oPurg = GetWaypointByTag("WP_PURG");
// Get the Locations for the Waypoints
lHeav = GetLocation(oHeav);
lHell = GetLocation(oHell);
lPurg = GetLocation(oPurg);
// Set some Effects for Respawning
// Change these effects as desired by simply changing
// the effect in EffectVisualEffect(*chages*);
eHell = EffectVisualEffect(VFX_IMP_HARM);
ePurg = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
eHeav = EffectVisualEffect(VFX_IMP_HEALING_X);
// Get the PC's Death Location for Respawn Later
lDeath = GetLocation(oPC);
// Set PC's Respawn Location in a Local Variable
SetLocalLocation(oPC, "Res_Loc", lDeath);
// Get the PC's Alignment to determine where to go
if (GetGoodEvilValue(oPC) <= 29)
{
// Do some Respawning Effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHell, oPC);
// Set the PC's Alignment Value for the Return Effects
SetLocalInt(oPC, "Res_Align", 1);
// Send the PC to the Afterlife
AssignCommand(oPC, JumpToLocation(lHell));
}
else if ((GetGoodEvilValue(oPC) >= 30) && (GetGoodEvilValue(oPC) <= 70))
{
// Do some Respawning Effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, ePurg, oPC);
// Set the PC's Alignment Value for the Return Effects
SetLocalInt(oPC, "Res_Align", 2);
// Send the PC to the Afterlife
AssignCommand(oPC, JumpToLocation(lPurg));
}
else if (GetGoodEvilValue(oPC) >= 71)
{
// Do some Respawning Effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeav, oPC);
// Set the PC's Alignment Value for the Return Effects
SetLocalInt(oPC, "Res_Align", 3);
// Send the PC to the Afterlife
AssignCommand(oPC, JumpToLocation(lHeav));
}
// Find out who or what killed the PC
sKiller = GetName(GetLastHostileActor(oPC));
// Tell the PC who or what killed him
SendMessageToPC(oPC, "Killed by " + sKiller);
// Remove all Effects and Magic from the PC
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDispelMagicAll(20), oPC);
}