This is an old Level-Up script I found on the old forum in 2004. I modified it to go to lvl 40.
I can't take any credit for this script, I did not create it and I have no idea who did.
Put this on a "Actions Taken" of a conversation node:
int XPtoLevel(int nXP) {
return FloatToInt((1+sqrt(1+4.*nXP/500))/2);
}
void main()
{
object player = GetPCSpeaker();
int nLevel = XPtoLevel(GetXP(player));
if (nLevel != 40) {
SetXP(player, nLevel*(nLevel+1)*500);
int iMeslev = (nLevel+1);
string sMes = ("You are now level " + IntToString(iMeslev));
AssignCommand(player, ActionSpeakString(sMes));
} else {
AssignCommand(player, ActionSpeakString("You are level 40, which is the maximum."));
}
}
I've been using this in character creation modules ever since I found it.
Have fun with it
'>