Author Topic: Level Check on Load  (Read 353 times)

Legacy_Dragonfolk2000

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Level Check on Load
« on: October 09, 2010, 06:23:47 pm »


               I need a line of code that checks any new PCs entering a mod to see if they are high enough level. If they are not then they are given the amount of experience needed to meet the base level. For the sample script lets make it level 3.

If PC Level < 3 then
 Award PC XP = 3000-PC's Current XP
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Level Check on Load
« Reply #1 on: October 09, 2010, 06:41:32 pm »


               Here is a module start script that I use. It does several things.
1) sets the maximum number of henchmen to 4.
2) levels up the pc to level 4 if they aren't that high already.
3) raises their gold level to 5600 gold if they don't have that much gold.
4) Sets a couple of dynamic conversation strings that I use. These can be used in a conversation and changed periodically so that the NPCs say different things when you talk to them multiple times.
5) Sets a resurrect flag to a particular waypoint so the PC respawns there.  It can get set somewhere else later if you want to change where the PC will respawn.  This requires some additional code in the OnDeath script  that isn't shown here.


void main()
{
   SetMaxHenchmen(4);
   object pc = GetFirstPC();
   int xp = GetXP( pc );
   int newxp = 0;
   if( xp < 6250 )
   {
      newxp = 6250;
      SetXP( pc, newxp );
   }
   int gold = GetGold( pc );
   if( gold < 5600 )
   {
      int newgold = 5600 - gold;
      GiveGoldToCreature( pc, newgold );
   }
   string s ="Is there anything I can do to help?";
   SetCustomToken( 2, s );
   s = "I haven't got time for idle conversation?";
   SetCustomToken( 3, s );

   int resset = GetLocalInt( pc, "resurrect");
   if( resset == 0 )
   {
    SetLocalInt( pc, "resurrect", 1 );
   }

}
               
               

               


                     Modifié par Mudeye, 09 octobre 2010 - 05:42 .
                     
                  


            

Legacy_Dragonfolk2000

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Level Check on Load
« Reply #2 on: October 09, 2010, 10:27:19 pm »


               I think I figure out how to omit the stuff I don't want. Thanks.