void main() { object oPC = GetPCSpeaker(); int nLevel = GetHitDice(oPC); //Get level int nXP = GetXP(oPC); //Save XP so we can restore it afterwards int nLevelXP = (nLevel) * (nLevel + 2) * 500; //Work out how much XP will delevel the PC SetXP(oPC, nLevelXP); //Set that level }