This is very easy, and doesn't require any patch. Just use GetLevelByPosition, which will tell you the level of the character's 1st, 2nd, or 3rd class:
// A creature can have up to three classes. This function determines the
// creature's class level based on nclass Position.
// - nclassPosition: 1, 2 or 3
// - oCreature
// * Returns 0 if oCreature does not have a class in nclassPosition
// (i.e. a single-class creature will only have a value in nclassLocation=1)
// or if oCreature is not a valid creature.
int GetLevelByPosition(int nclassPosition, object oCreature=OBJECT_SELF)
Check to see if your conditions are violated on levelup, and if they are, delevel the pc:
void DelevelPC (object oPC) {
int nLevel = GetHitDice(oPC);
int nNewXP = ((nLevel * (nLevel - 1)) / 2 * 1000) - 1;
SetXP(oPC, nNewXP);
}
Funky
Modifié par FunkySwerve, 29 septembre 2011 - 01:32 .