I was testing some encounters in our PW and discovered that when a player respawns they do not get a penalty (no reduction in xp and gold). [On a PW, never rely on players to let you know a bug that is advantageous to them
'>]. That's certainly not the intention and our module respawn script has worked in the past, so I took a look. It's fairly basic, as follows:
--------------------------------------------
#include "nw_i0_plot"
#include "aps_include"
#include "_cb_core"
#include "ldp_include"
void unEquip(object oPlayer);
// * 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.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 ApplyHeavyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nHD = GetHitDice(oDead);
int nNewXP = ((( nHD * ( nHD - 1)) / 2) * 1000)-((( nHD-1 ) * 1000 ) / 2 );
SetXP(oDead, nNewXP);
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));
unEquip(oDead);
}
//////////////////////////////////////////////////////////////////////////////
After that are database functions and a penalty if the player does not get raised before they've respawned 3 times (they lose a level). Curiously, the level penalty does work. The database functions get updated. The gold and xp penalties, however, do not happen.
I added some shouts to the script to see what is firing and what isn't, as follows:
----------------------------------------------
#include "nw_i0_plot"
#include "aps_include"
#include "_cb_core"
#include "ldp_include"
void unEquip(object oPlayer);
// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
SpeakString("nXP: "+IntToString(nXP), TALKVOLUME_SHOUT);
int nPenalty = 50 * GetHitDice(oDead);
SpeakString("nPenalty: "+IntToString(nPenalty), TALKVOLUME_SHOUT);
int nHD = GetHitDice(oDead);
SpeakString("nHD: "+IntToString(nHD), TALKVOLUME_SHOUT);
// * 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;
SpeakString("nNewXP: "+IntToString(nNewXP), TALKVOLUME_SHOUT);
SetXP(oDead, nNewXP);
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));
}
//////////////////////etc...
I get nothing. I don't get any shouts, much less get any values returned.
Does anyone have an idea on what the culprit here is?
Thanks - Badwater