RATDOG/_module/nss/69_o0_death.nss
Jaysyn904 0f13e6c538 Initial module commit
Initial module commit.
2021-08-29 23:34:48 -04:00

113 lines
4.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Death Script
//:: NW_O0_DEATH.NSS
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:: Modified: 69MEH69 AUG2003
//:://////////////////////////////////////////////
#include "69_hench_lib"
void EndGame69(object oPlayer)
{
if(GetCurrentHitPoints(oPlayer) <= 0)
DelayCommand(10.0, PopUpDeathGUIPanel(oPlayer,TRUE,TRUE,64521));
}
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//Search for negative effects
while(GetIsEffectValid(eBad))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//Remove effect if it is negative.
RemoveEffect(oPlayer, eBad);
}
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}
void main()
{
int PC_BLEEDING = GetLocalInt(GetModule(), "PC_BLEEDING");
object oPlayer = GetLastPlayerDied();
string sPlayer = GetName(oPlayer);
float fDelay = 5.0;
// * increment global tracking number of times that I died
SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);
if(PC_BLEEDING == 1)
{
//Henchman Cleric Code
object oHealer = GetHenchman(oPlayer);
string sName;
location lLoc;
int nRoll;
while(oHealer != OBJECT_INVALID)
{
HenchRessurect69(oPlayer, oHealer);
oHealer = GetHenchman(oHealer);
}
}
//End Henchman Cleric Code
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
// * BK: Automation Control. Autopcs ignore death
if(GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
{
Raise(oPlayer);
DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
}
if(GetHenchmanTotal69(oPlayer) > 0)
{
fDelay = 20.0;
}
DelayCommand(fDelay, EndGame69(oPlayer));
}