Author Topic: Forcing level requiriment on a server  (Read 954 times)

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Forcing level requiriment on a server
« on: May 27, 2011, 07:52:18 pm »


               Is there a way to force it?

What I mean is, set it to something it normally couldn't be set and/or modifying it on the fly.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #1 on: June 03, 2011, 03:13:12 pm »


               I think the level restrictions are controlled by 2da's

If you wanted to change them, you would need to alter the 2da files on the server.

I dont know if they are loaded into memory and cached, so

1. You could potentially use a nwnx plugin to read and write to the 2da on the fly.
but this would only work if the 2da is not cached on each startup.

if the 2da is cached on startup, then changing it on the fly wont be possible, unless a nwnx plugin was used to refresh it somehow.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #2 on: June 03, 2011, 09:08:51 pm »


               They are? Which .2da controls it then?
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #3 on: June 03, 2011, 10:49:53 pm »


               Hello,

Pretty sure max level is only a command line switch on the server or an ini setting.  I have a plugin that I called nwnx_levels that I'm going to post up soon (for linux).  it allows changing max level on the fly.  it doesn't currently encompass all that you might want since I built solely to do 'real' 1-60th levels for PCs, but it could be extended easily enough.  It's been in limited production for a few months on my server.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #4 on: June 04, 2011, 07:04:45 am »


               The values given in itemvalue.2da seem to match up.  It wouldn't be too hard to work something off those values to allow for ECL or situational modifiers to character level, though, admittedly, raising the restrictions is easier than lowering them.

 Turning off ILR by default, then adding a check to the spellhook and OnEquip scripts is the only way I can think of doing it for both raising and lowering "on the fly", though the items won't show up as unusable in the inventory.
 NWNX allows forced item unequipping, which covers any worn item easily in the OnEquip script, and all activated effects and spells run through the spellhook.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #5 on: June 11, 2011, 05:17:40 pm »


               Oh wow I just now realize how lacking my OP was. I ment the min/max level of a server... Any chance this plugin of yours coming to windows leo?
               
               

               


                     Modifié par Xardex, 11 juin 2011 - 04:18 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Forcing level requiriment on a server
« Reply #6 on: June 11, 2011, 06:19:23 pm »


                 I control maximum level in my mod entirely through the XP script.  In my case, it's level + ECL for a maximum level of 20, but the maximum could easily be set as either a module or PC specific variable.  As long as you run all XP awards through a single script it's an easy application to insert.  I check level based on XP to prevent people from being able to exploit the XP system I have in by not taking levels.

This is (essentially) all I use:

if (GetHitDiceByXP (oTarget) + GetSkinInt (oTarget, "ECL") < 20) )
     {
       GiveXPToCreature (oTarget, nXPReward);
     }

which references:

///////////////////////////////////////////////////////////////////////////////
// By th1ef
// GetHitDiceByXP
//  HitDice is determined by player's xp, not by whether or not they have
//   leveled
//  Solve for hd from xp = hd * (hd - 1) * 500
//   hd = 1/50 * (sqrt(5) * sqrt(xp + 125) + 25)
int GetHitDiceByXP(object oCreature)
{
   float fXP = IntToFloat(GetXP(oCreature));
   return FloatToInt(0.02f * (sqrt(5.0f) * sqrt(fXP + 125.0f) + 25.0f));
}


Something like that might work for you until you can get a NWNX plugin to handle it, though it's still limited by the number set in the module maximum level regardless.