Author Topic: Script to Set XP  (Read 313 times)

Legacy_Rowwena

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
Script to Set XP
« on: July 07, 2011, 10:21:01 pm »


               Hi,
I am having a problem with this one. I have tried one I found at the lexicon, and another I pulled from the OC and tried to modify, but I could not get either to work, even when they said they compiled.

I am looking for a script that will set the PC's experience. Basically, I want one that is called on from the end of a conversation that, like in the OC, will advance the PC to level 3 before moving on to the next area. I know that I could just give them XP the normal way, but since some of the previous encounters are optional, I do not want the PCs that do these to advance beyond the level points.

This is for a single player/stand-alone module.

Any help would be appreciated.
               
               

               
            

Legacy_Rowwena

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
Script to Set XP
« Reply #1 on: July 07, 2011, 10:40:45 pm »


               Nevermind, I found one here. Got luck with searching Google for once.

http://social.biowar...-4744022-1.html

Thanks Okto
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Script to Set XP
« Reply #2 on: July 08, 2011, 01:10:00 am »


               Your script can be a lot simpler then the link you posted.   You already know the level you want them to be (3) and that they will need and the amount of xp that they will need for that level (3000) .  So just set it. Of cource a check to make sure you are not going to take any away would not hurt. 

void main()
{
  object oPC = GetPCSpeaker();
  int xp = GetXP(oPC);
  // check to make sure that you are not going to take XP away from the PC.
  if (xp < 3000) SetXP(oPC,3000);