Author Topic: Get unspent skill points  (Read 361 times)

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Get unspent skill points
« on: March 18, 2013, 07:22:29 pm »


               Hi,
i always wondered if there is a way to get the number of a players unspent skill points via script. Searching the nwlexicon gave me no result and calculating it from already spent skill points, classes and intelligence score seems just meh.

So, does anyone know of some way ? (not involving any extensions like nwncx)
               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Get unspent skill points
« Reply #1 on: March 18, 2013, 07:49:13 pm »


               Calculating it from spent skill points and classes would actually be pretty easy, could whip up a script in five minutes for that.  However, I'm not sure what to do about intelligence - or more specifically how to deal with the fact that character may have increased their intelligence (especially wizards).

I could detect any Great Intelligence feats and assume that every stat point was put into Intelligence if the person has mostly Wizard levels, but it would be possible for that assumption to be incorrect.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Get unspent skill points
« Reply #2 on: March 18, 2013, 08:47:29 pm »


               

MagicalMaster wrote...

Calculating it from spent skill points and classes would actually be pretty easy, could whip up a script in five minutes for that.  However, I'm not sure what to do about intelligence - or more specifically how to deal with the fact that character may have increased their intelligence (especially wizards).

I could detect any Great Intelligence feats and assume that every stat point was put into Intelligence if the person has mostly Wizard levels, but it would be possible for that assumption to be incorrect.

It would be possible to calculate this precisely if we knew the when the intelligence score changed. Best way would be to track it manually, but there is a way to figure it out for existing characters as well.

Provided this is only used in OnLevelUp and then it can be stored, it wouldnt be so inefficient.

Simpy make a copy of the PC in hidden area and delevel it continuously and keep track of base intelligence score at levels. Well, is really isnt that simple '<img'> but possible.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Get unspent skill points
« Reply #3 on: March 18, 2013, 09:48:42 pm »


               If you're using NWNX and nwnx_funcs it's quite easy:


/* Gets oPC's remaining skill points. */
int GetPCSkillPoints (object oPC);

/* Sets oPC's remaining skill points. */
int SetPCSkillPoints (object oPC, int nSkillPoints);

Funky
               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Get unspent skill points
« Reply #4 on: March 18, 2013, 09:56:34 pm »


               Sadly...

Asymmetric wrote...

(not involving any extensions like nwncx)


So the hard way it is.
               
               

               


                     Modifié par MagicalMaster, 18 mars 2013 - 09:56 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Get unspent skill points
« Reply #5 on: March 18, 2013, 11:03:01 pm »


               Delevel a copy and it will tell where the intelligence was changed.

There is one snag to this approach.  When you copy a creature the Great Ability feats get applied a second time, and when you delevel only one instance gets removed.  (So if I had Great Int IX and deleveled a copy the copy will always have an intelligence 9 higher than I would have at that level). I did not specifically test RDD 9 (+2 Int at that level), but I am betting this is broken (sometimes working and sometimes not depending on the build) for deleveling, so you would have to also report the RDD level as you delevel to figure out what character level the RDD 9 took place.

Example (only sends feedback, doesn't use the feedback for calculations):
void main()
{
object oCopy = CopyObject(OBJECT_SELF, GetLocation(OBJECT_SELF));
int nHD = GetHitDice(oCopy);
while(nHD--)
 {
 SetXP(oCopy, nHD * (nHD + 1) * 500);
 SendMessageToPC(OBJECT_SELF, "INT: "
   + IntToString(GetAbilityScore(oCopy,  ABILITY_INTELLIGENCE, TRUE))
   + "\\n" +  "HD: " + IntToString(GetHitDice(oCopy)));
 }
}
               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Get unspent skill points
« Reply #6 on: March 18, 2013, 11:46:26 pm »


               Thanks folks, I guess I'll have to take nwnx into consideration again. I hoped for some easy solutions I may have overlooked.

MagicalMaster wrote...

So the hard way it is.

Always. It wouldn't be as much fun otherwise '<img'>
               
               

               


                     Modifié par Asymmetric, 18 mars 2013 - 11:47 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Get unspent skill points
« Reply #7 on: March 19, 2013, 03:56:57 am »


               

WhiZard wrote...

Delevel a copy and it will tell where the intelligence was changed.

There is one snag to this approach.  When you copy a creature the Great Ability feats get applied a second time, and when you delevel only one instance gets removed.  (So if I had Great Int IX and deleveled a copy the copy will always have an intelligence 9 higher than I would have at that level).

that is easy to solve, after copying compare intelligence of the original and copy and if it differs store a difference modifier and apply this modifier to all score calculations later.

it is interesting though, i didnt knew about this issue
               
               

               


                     Modifié par ShaDoOoW, 19 mars 2013 - 03:57 .