Initial upload
Initial upload
This commit is contained in:
56
_module/nss/xx_cb_respawn.nss
Normal file
56
_module/nss/xx_cb_respawn.nss
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "nw_i0_plot"
|
||||
|
||||
// * Applies an XP and GP penalty
|
||||
// * to the player respawning
|
||||
void ApplyPenalty(object oDead)
|
||||
{
|
||||
int nXP = GetXP(oDead);
|
||||
int nPenalty = 50 * 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.35 * GetGold(oDead));
|
||||
// * a cap of 10 000gp taken from you
|
||||
if (nGoldToTake > 200000)
|
||||
{
|
||||
nGoldToTake = 200000;
|
||||
}
|
||||
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
||||
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
||||
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
||||
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// WriteTimestampedLogEntry("Entering Module onPlayerRespawn: xx_cb_respawn");
|
||||
object oRespawner = GetLastRespawnButtonPresser();
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
||||
RemoveEffects(oRespawner);
|
||||
string sDestTag = "trinity_respawn";
|
||||
ApplyPenalty(oRespawner);
|
||||
string sArea = GetTag(GetArea(oRespawner));
|
||||
|
||||
if (sArea == "EVILARENA" || sArea == "GOODARENA")
|
||||
{
|
||||
sDestTag = "wp_pvp_respawn";
|
||||
}
|
||||
|
||||
object oSpawnPoint = GetWaypointByTag(sDestTag);
|
||||
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
|
||||
SetLocalInt(oRespawner,"BypassLocation",1);
|
||||
SetLocalInt(oRespawner,"Dead",0);
|
||||
SetCampaignInt("PlayerData","Dead",0,oRespawner);
|
||||
SetCampaignLocation("PlayerData","Location",GetLocation(oSpawnPoint),oRespawner);
|
||||
|
||||
|
||||
// WriteTimestampedLogEntry("Exiting Module onPlayerRespawn: xx_cb_respawn");
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user