Bah, having connectivity issues. Here's the onlevelup code to block taking of prestige classes. It uses a different variable than your client enter script, so I'm providing a modified client enter script as well. It assumes the tokens that allow a prestige will have tags of the format:
Allowclass_X
Where x is the number of the class, taken from the const. The numbers are:
Shadowdancer 27
Harper 28
Arcane_Archer 29
Assassin 30
Blackguard 31
Champion of Torm 32
Weaponmaster 33
Pale Master 34
Shifter 35
Dwarven Defender 36
Dragon Disciple 37
Purple Dragon Knight 41
So a token allowing the player to take shadowdancer levels would have to have the tag Allowclass_27, for example.
Here's the onlevelup:
void DelevelPC(object oPC) {
int nLevel = GetHitDice(oPC);
int nNewXP = ((nLevel * (nLevel - 1)) / 2 * 1000) - 1;
SetXP(oPC, nNewXP);
}
void CheckRestrictedclass(object oPC, int nclass) {
if (GetLevelByclass(nclass, oPC) > 0) {
if (!GetLocalInt(oPC, "Allowclass_"+IntToString(nclass)) &&
!GetIsObjectValid(GetItemPossessedBy(oPC, "Allowclass_"+IntToString(nclass)))) {
DelevelPC(oPC);
FloatingTextStringOnCreature("You cannot take prestige classes without the required token!", oPC, FALSE);
}
}
}
void main() {
object oPC = GetPCLevellingUp();
int nX;
for (nX = 27; nX < 42; nX++)
CheckRestrictedclass(oPC, nX);
}
And here is the onenter code, modified to use the new variable:
#include "_pw_journal_inc"
void GrandfatherPrestigeclasses(object oPC) {
int nX;
for (nX = 27; nX < 42; nX++) {
if (GetLevelByclass(nX, oPC) > 0)
SetLocalInt(oPC, "Allowclass_"+IntToString(nX), 1);
}
}
void main()
{
object oPC = GetEnteringObject();
RestorePersistentJournal(oPC);
GrandfatherPrestigeclasses(oPC);
ExecuteScript ("cnr_module_oce", oPC);
}
In case you're wondering WHY I switched to using a new variable, it was so I could do those tidy little for loops instead of a big clunky list.
Funky
Modifié par FunkySwerve, 07 décembre 2010 - 08:41 .