59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
//This script will onrespawn penalize xp loss per level and
|
|
//take x% of the players gold. Put it under the onrespawn tag under
|
|
//module properties. I get way less complaints since the penalty is minor,
|
|
//but it cuts down on poor players just dying over and over without penalty.
|
|
|
|
|
|
|
|
#include "nw_i0_plot"
|
|
|
|
// * Applies an XP and GP penalty
|
|
// * to the player respawning
|
|
void ApplyPenalty(object oDead)
|
|
{
|
|
int nXP = GetXP(oDead);
|
|
//Sets XP to take from player, default is 50 * GetHitDice (= 50 XP per player level)
|
|
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);
|
|
//Sets GP to take, default is 0.10 (= 10% of GP)
|
|
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
|
|
// * a cap of 10 000gp taken from you
|
|
if (nGoldToTake > 10000)
|
|
{
|
|
nGoldToTake = 10000;
|
|
}
|
|
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
|
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
|
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
|
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// Define who respawned and ressurect them, clear effects
|
|
|
|
object oRespawner = GetLastRespawnButtonPresser();
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
|
RemoveEffects(oRespawner);
|
|
|
|
// Take 10% gold and 10% xp
|
|
|
|
ApplyPenalty(oRespawner);
|
|
|
|
// Set the Local Integers that the NPC that teleports looks for
|
|
// conversation purposes and to define the area that he teleports
|
|
// the group to
|
|
|
|
|
|
|
|
}
|
|
|