SetXP(object, int)
Sets a creatures experience points to a particular value.
void SetXP( object oCreature, int nXpAmount );
Parameters
oCreature
nXpAmount
Description
Sets oCreature's experience to nXpAmount.
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 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.
Only PCs use XP. To level up an NPC, use LevelUpHenchman.
Version
1.61
Example
// make a PC at least 2nd level in an on enter script
void main()
{
int iXP;
object oCreature = GetEnteringObject();
iXP = GetXP(oCreature);
if (iXP < 1000)
{
SetXP(oCreature, 1000);
}
}
See Also
| functions: | GetXP | GiveXPToCreature |
| categories: | Experience Functions |
author: Chaz Mead, editor: Lilac Soul, additional contributor(s): Lilac Soul
Send comments on this topic.