SetXP(object, int)
Sets a creatures experience points to a particular value.
Parameters
- oCreature
- nXpAmount
Description
Sets oCreature's experience to nXpAmount. Obviously oCreature must be a player object. NPCs do not have levels (but can be "levelled up" using LevelUpHenchman).
nXPAmount, of course, cannot be lower then 0. It can be as high as you wish, but the maximum level for Original NwN is 190000 (level 20) and Hordes of the Underdark it is 780000 (level 40) as set in exptable.2da.
To set, or even attain, experience levels higher then this just means "Maximum level" is displayed in the PCs character sheet, where it usually says "Next level: ".
Remarks
The GiveXPToCreature function is a more natural way to modify XP, but SetXP can be useful if you know exactly how much XP you want a creature to have. This function also bypasses penalties on:
- Multiclassing
- Having multiple party members
This function could be useful for situations where XP was modified by a percentage.
Also, you MUST use SetXP if you want to lower a PC's XP. GiveXPToCreature doesn't work for lowering the XP, but SetXP() does, and can be used to make the PC's start at a particular (lower) level then usual, or to force level loss at a particular time.
Only PCs use XP. To level up (but unable to level down) an NPC, use LevelUpHenchman.
Version
1.62
Example
See Also
functions: |
author: Chaz Mead, editor: Jasperre, additional contributor(s): Lilac Soul, Jasperre