19 lines
678 B
Plaintext
Raw Permalink Normal View History

/// Determines how long to wait before restoring the target's XP value
const float XP_RESTORE_DELAY = 1.0f;
void main()
{
object oTarget = GetPCSpeaker();
int nLevels = 1;
int nOrigXP = GetXP(oTarget);
int nOrigHD = GetHitDice(oTarget);
int nTargetHD = nOrigHD - nLevels;
SetXP(oTarget, ((nTargetHD * (nTargetHD - 1)) / 2) * 1000);
// Schedule the OnLevelDown virtual event to be run right away
SetLocalInt(oTarget, "PRC_OnLevelDown_OldLevel", nOrigHD);
DelayCommand(0.0f, ExecuteScript("prc_onleveldown", oTarget));
SetXP(oTarget, nOrigXP);
TakeGoldFromCreature (5000, oTarget);
}