Author Topic: NPC Training for PCs  (Read 355 times)

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
NPC Training for PCs
« on: August 18, 2011, 10:39:18 am »


               I have an idea I want to implement: to make it so, in order to level up in a class, a PC needs training from a NPC of higher level in that class. By using the SCRIPTVAR requirement in the cls_pres_*.2da files, I can make the training be required. However, I'd like the PCs to only be able to train if they have an unspent level-up. How do I check for that?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPC Training for PCs
« Reply #1 on: August 18, 2011, 12:34:16 pm »


               If you wanted it as a starting condition you could do it like this.

int StartingConditional()
{
  object oPC =GetPCSpeaker();
  int nHD= GetHitDice(oPC);
  int nXP = GetXP(oPC);
 
int bCanLevel = ( (nHD+1)*nHD*500 < nXP );

  return  bCanLevel;
}


               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
NPC Training for PCs
« Reply #2 on: August 18, 2011, 04:09:24 pm »


               int bCanLevel = ( (nHD+1)*nHD*500 < nXP );

That's some pretty snappy code there Lightfoot8, bravo! '<img'>
               
               

               
            

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
NPC Training for PCs
« Reply #3 on: August 18, 2011, 08:57:16 pm »


               Excellent! '<img'>