OnPlayerLevelUp Max HP

Is there a way to give players max HP when leveling up on a servervault run server?

Something to add to the OnPlayerLevelUp event?

This should do the trick:


void main
oPC = GetPCLevellingUp();
int iMAXHP = GetMaxHitPoints(oPC);
int iHP = GetCurrentHitPoints(oPC);
effect eHeal = EffectHeal(iMAXHP - iHP);
if (iHP>0)
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);

It wont trigger until they confirm their selection on the level up screen, meaning they will NOT be healed mid combat as soon as they have enough XP to level up. This is because “OnPlayerLevelUp” triggers when level up selection is confirmed (where you click cancel/confirm based on how many hit points you rolled.)

Also, I’m not sure EffectHeal is optimal, as it will also stop people from dying and remove wounding effects, but I’m writing things from memory (with help from lexicon) as NWN is currently not installed. If there’s a way to simply “SetCurrentHitPoints” that would probably be better. EffectHeal probably has a healing visual effect as well.

Edit: I changed the code to only heal people who are above 0 hp. Otherwise they would be able to ‘save a level up’ until/in case they died, at which point they would be able to jump right back. This is in case your server has the thing where people bleed out and can be stabilized. If it doesn’t, then it doesn’t matter because the character should be dead at 0 hp anyway.

1 Like

Isn’t there a .ini setting to enable this without scripting?


1 Like

In nwnplayer.ini
[Server Options]
Max Hit Points=1


Thank you! I don’t know how I missed this.