WoR_PRC8/_module/nss/rhun_onpc_respwn.nss

102 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 11:49:34 -04:00
//::///////////////////////////////////////////////
//:: Generic On Pressed Respawn Button
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
// * June 1: moved RestoreEffects into plot include
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: November
//:://////////////////////////////////////////////
#include "nw_i0_plot"
#include "x0_i0_campaign"
//#include "sha_subr_methds"
// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead)
{
if(GetHitDice(oDead) >= 5){
int nXP = GetXP(oDead);
int nPenalty = 75 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
//int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
int nNewXP = nXP - nPenalty;
// if (nNewXP < nMin)
// nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 1000000)
{
nGoldToTake = 1000000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));}
else {
//Do Nothing
}
}
void main()
{
//Shayan's Subrace Engine Code
//SubraceOnPlayerRespawn(); //:: Replaced by PRC
//End Shayan's Subrace Engine Code.
object oRespawner = GetLastRespawnButtonPresser();
SetLocalInt(oRespawner, "DEAD_TIME_REMAINING", 0);
//so that the script can be executed on a dying Player
if(GetIsPC(OBJECT_SELF))
{
oRespawner = OBJECT_SELF;
}
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
//ReapplySubraceAbilities(oRespawner); //:: Replaced by PRC
SendMessageToPC( oRespawner, "rhun_onpc_respwn: Executing s_factions.nss" );
ExecuteScript("s_factions", oRespawner);
SetCampaignDBInt(oRespawner, "PLAYERHASDIED", FALSE);
string sDestTag = "NW_DEATH_TEMPLE";
string sArea = GetTag(GetArea(oRespawner));
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
{
if (sDestTag == "NW_DEATH_TEMPLE")
{
object oPriest = GetObjectByTag("NW_DEATH_CLERIC");
//SetLocalInt(oPriest, "NW_L_SAYONELINER", 10);
//AssignCommand(oPriest, DelayCommand(3.0,ActionStartConversation(oRespawner)));
AssignCommand(oPriest, DelayCommand(2.1, PlayVoiceChat(VOICE_CHAT_TALKTOME, oPriest)));
SetLocalLocation(oRespawner, "NW_L_I_DIED_HERE", GetLocation(oRespawner));
SetLocalInt(oRespawner, "NW_L_I_DIED", 1);
SetLocalObject(oPriest, "NW_L_LASTDIED", oRespawner);
// * April 2002: Moved penalty here, only when going back to the death temple
ApplyPenalty(oRespawner);
}
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
// * mak
}
else
{
// * do nothing, just 'res where you are.
}
}