GetXP(object)

Get a given creature's experience.

int GetXP(
    object oCreature
);

Parameters

oCreature

Target creature.


Description

Returns oCreature's experience points (XP).



Remarks

One use for this function is if you want to take XP away from a PC. GiveXPToCreature doesn't work with negative amounts of XP, so you'll first have to calculate the XP the PC should have, then set it with SetXP. See code sample below for a wrapper function that can be used to both give and take XP from a PC.


Version

1.61

Example

void GiveXP(object oPC, int nXP)
{
//Calculate new XP value
nXP=GetXP(oPC)+nXP;

SetXP(oPC, nXP);

}

See Also

functions: SetXP
categories: Experience Functions | Get Data from Creature Functions


 author: Kristian Markon, editor: Lilac Soul
 Send comments on this topic.