2023-08-08 16:22:17 -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"
|
|
|
|
|
|
|
|
// * Applies an XP and GP penalty
|
|
|
|
// * to the player respawning
|
|
|
|
void ApplyPenalty(object oDead)
|
|
|
|
{
|
|
|
|
|
|
|
|
int nPenalty = 50 * GetHitDice(oDead);
|
|
|
|
int nXP = GetXP(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);
|
|
|
|
|
2023-08-11 19:23:28 -05:00
|
|
|
int nGoldToTake = FloatToInt(0.05 * GetGold(oDead));
|
2023-08-08 16:22:17 -04:00
|
|
|
// * a cap of 100000gp taken from you
|
|
|
|
if (nGoldToTake > 100000)
|
|
|
|
{
|
2023-08-11 19:23:28 -05:00
|
|
|
nGoldToTake = 20000;
|
2023-08-08 16:22:17 -04:00
|
|
|
}
|
|
|
|
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
|
|
|
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
|
|
|
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
object oRespawner = GetLastRespawnButtonPresser();
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
|
|
|
RemoveEffects(oRespawner);
|
|
|
|
DeleteLocalInt(oRespawner,"PCDead");
|
|
|
|
|
|
|
|
//* Return PC to temple
|
|
|
|
string sDestTag = "NW_DEATH_TEMPLE";
|
|
|
|
string sArea = GetTag(GetArea(oRespawner));
|
|
|
|
int ispawn = GetCampaignInt("respawn_point",GetPCPlayerName(oRespawner),oRespawner);
|
|
|
|
|
|
|
|
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
|
|
|
|
{
|
|
|
|
|
|
|
|
if (sArea != "TheStadium")
|
|
|
|
{
|
|
|
|
if(ispawn==1)
|
|
|
|
{
|
|
|
|
ApplyPenalty(oRespawner);
|
|
|
|
object oSpawnPoint = GetObjectByTag("deathtemple_nas");
|
|
|
|
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
|
|
|
}
|
|
|
|
if(GetHitDice(oRespawner)<=5)
|
|
|
|
{
|
|
|
|
object oSpawnPoint = GetObjectByTag(sDestTag);
|
|
|
|
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
|
|
|
SendMessageToPC(oRespawner,"You will suffer no XP or GP penalties until level 5");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ApplyPenalty(oRespawner);
|
|
|
|
object oSpawnPoint = GetObjectByTag(sDestTag);
|
|
|
|
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
//stadium respawn
|
|
|
|
if (sArea == "TheStadium")
|
|
|
|
{
|
|
|
|
object oRespawner = GetLastRespawnButtonPresser();
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
|
|
|
RemoveEffects(oRespawner);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|