Limiting PC Advancement Based on Criteria Edit

What it does Edit

This script will allow you to prevent a PC from advancing beyond a certain level in a class based on whatever criteria you choose. For the example I'll say that female Half-Orcs cannot advance beyond level 5 in wizard classes.

The Script Edit

Put the script in the 'OnPlayerLevelUp' event in your module properties:

//:: Created By: Zephrym
//:: Created On: 18 Aug 2002
void main()
    object oPC = GetPCLevellingUp();
    int nClassLvl = GetLevelByClass(CLASS_TYPE_WIZARD, oPC);
    int nXP = GetXP(oPC);
    int nAdj = 0; int n;
// Calculates the minimum XP needed for current level
    for(n=0;n<GetHitDice(oPC);n++) nAdj = nAdj + (n * 1000);
    if(GetGender(oPC) == GENDER_FEMALE && GetRacialType(oPC) == RACIAL_TYPE_HALFORC && nClassLvl > 5){
        AssignCommand(oPC, ClearAllActions());
        SetXP(oPC, nAdj - 500);
        DelayCommand(1.0, SetXP(oPC, nXP));
    FloatingTextStringOnCreature("You cannot advance beyond wizard level "+ IntToString(nClassLvl)+" as a female Half-Orc.", oPC, FALSE);

Note Edit

It works like a charm. Obviously, you have to change the ints to something you want to test for but it's all there and easily expandable to include anything you can query about the PC.

Update: You can use a number as small as 1 for the script if you want since the loop calculates the exact XP for the current HD.

For reference, the OnPlayerLevelUp script fires AFTER the player completes the level up selection process.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.