Author Topic: Relevel Script  (Read 318 times)

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Relevel Script
« on: December 20, 2012, 04:39:09 pm »


               I need a script to relevel their last level. Also, I need to make sure that they don't relevel to max appraise and relevel to retake their skills.. Help please? '<img'> Thanks

(Script would run off conversation)
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Relevel Script
« Reply #1 on: December 20, 2012, 11:37:06 pm »


               A little more clarity will help us to help you. You've said when you DON'T want them to be able to relevel - what about when you DO want to allow it? Bear in mind that appraise is only one potential way to abuse such a system.

The mechanic for dropping someone to their last level is simple:

void DelevelPC (object oPC) {
        int nLevel = GetHitDice(oPC);
     int nNewXP = ((nLevel * (nLevel - 1)) / 2 * 1000) - 1;

        SetXP(oPC, nNewXP);
}

If you want to relevel them, just get their xp, and after you delevel, reset it back to where it was. Like so:


//this function will drop them to 1 xp below what they need for their present level
void DelevelPC (object oPC) {
         int nLevel = GetHitDice(oPC);
         int nNewXP = ((nLevel * (nLevel - 1)) / 2 * 1000) - 1;

     SetXP(oPC, nNewXP);
}

void main() {
         object oPC = GetPCSpeaker();
         int nXP = GetXP(oPC);
         DelevelPC(oPC);
         SetXP(oPC, nXP);
}

Funky
               
               

               


                     Modifié par FunkySwerve, 20 décembre 2012 - 11:38 .