Added NPC to re-level or delete character
Modified npc pickup script to ignore quest item spawns.
This commit is contained in:
18
_module/nss/leveltake1.nss
Normal file
18
_module/nss/leveltake1.nss
Normal file
@@ -0,0 +1,18 @@
|
||||
/// 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);
|
||||
}
|
Reference in New Issue
Block a user