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