Initial Upload
Initial Upload
This commit is contained in:
90
_module/nss/_on_respawn.nss
Normal file
90
_module/nss/_on_respawn.nss
Normal file
@@ -0,0 +1,90 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: 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);
|
||||
|
||||
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
|
||||
// * a cap of 100000gp taken from you
|
||||
if (nGoldToTake > 100000)
|
||||
{
|
||||
nGoldToTake = 100000;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user