Author Topic: SAVED: Level up script.  (Read 303 times)

Legacy_Okto

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SAVED: Level up script.
« on: September 09, 2010, 09:52:55 pm »


               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 '<img'>
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
SAVED: Level up script.
« Reply #1 on: September 10, 2010, 01:08:53 pm »


               Very nice, thanks.   '<img'>