• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed 230% Skill-Experience

I think the relevant function would be int AddCharacterExpNSChar(ref _refCharacter, string expName, int _exp) in PROGRAM\MAXIMUS_functions.c .

Would replacing this:
Code:
if (curExp >= nextExp)
With this:
Code:
while (curExp >= nextExp) // PB: Keep doing this while necessary
Be enough?

Probably also replace this:
Code:
   int nextSkill = 50000;
   if (curSkill >= nextSkill)
   {
With this:
Code:
   int nextSkill;
   while (curSkill >= nextSkill) // PB: Keep doing this while necessary
   {
     nextSkill = 50000; // PB: Move down to reset

Probably! I had just staggered through various areas of code:read to arrive at this very function to suggest that is where a loop should go! I was going to ask what sti() and stf() do - fairly obviously an integer and float equivalent operation but what is it?
Hopefully that will at least introduce the desired loop so that too high values result in actual skill and level increases instead of the numbers "sticking around".
This won't fix the reason why these sudden huge XP gains occur but at least should make them behave a bit more sensibly.

I did see this in the same function

// Make sure our character has all the necessary attributes
//==========================================================


if (!CheckAttribute(_refCharacter,"Experience."+expName))
{
_refCharacter.Experience.(expName) = makeint(sti(Rand(19)+1)*1000);

on my way here and wondered if that could be the trigger -although why a character should be created missing values in expName would then be the question.?
 
OK forget the above

_refCharacter.Experience.(expName) = makeint(sti(Rand(19)+1)*1000);

that can only make 20000 which I see below should only be 2 skill points.

I'll stick your code into the maximus function and run my saved game with her multiple 1000+ exp points through it and see what happens.
 
I was going to ask what sti() and stf() do - fairly obviously an integer and float equivalent operation but what is it?
sti is short for String To Integer and stf is String To Float .
There are also the makeint and makefloat functions which I think are used to convert int to float and the other way around.
 
Looks promising. Initially lots of characters seemed to be getting large boosts in skill (Hmm.. wonder if this is the high XP points of another unconfirmed bug thread??) but I currently have

int nextSkill = 50000;
while (curSkill >= nextSkill) // PB: Keep doing this while necessary
{
// nextSkill = 50000; // PB: Move down to reset

and a quick bout of smuggling and a fight with the coastguard upped her to 10's on melee,accuracy,commerce and luck (she is already 10 on two others. The only drawback is each skill needs an individual upgrade trigger and if you haven't got shared experience a passenger could stay with weird figures for a while.

I'm off for a couple of weeks but will further test a slimmed down complement (2 passengers and two officers (plus Danielle as a quest officer I think) when I return just to check that only the over 100% skills are getting boosted. I'd also like to get my head round why it is 50000 when higher up the function it is commented that 10000=1 skill level.

So sti("9.33") will return 9, stf("9.33") will return 9.33 and presumable you don't call sti("cannonballs") although some value would appear?

PS your tip on setting the windows search parameter is invaluable in my trying to find my way through the "jungle" that is POTC file code locations. No way could I have even started without it.

pps No internet but I may look through the Artois Voysey files at that pesky looping quest.
 
Last edited:
Looks promising. Initially lots of characters seemed to be getting large boosts in skill (Hmm.. wonder if this is the high XP points of another unconfirmed bug thread??) but I currently have

int nextSkill = 50000;
while (curSkill >= nextSkill) // PB: Keep doing this while necessary
{
// nextSkill = 50000; // PB: Move down to reset

and a quick bout of smuggling and a fight with the coastguard upped her to 10's on melee,accuracy,commerce and luck (she is already 10 on two others. The only drawback is each skill needs an individual upgrade trigger and if you haven't got shared experience a passenger could stay with weird figures for a while.
Indeed I can imagine that this wouldn't immediately fix currently bugged characters.
But if it prevents excessive weirdness on a new game, then at least that is a step in the right direction.

I suspect that the issue discussed here is a copy of this one: http://www.piratesahoy.net/threads/sudden-huge-amounts-of-xp-gained.24829/
Maybe I should merge those two threads to prevent confusion, but I'm not sure if they are indeed the same or not.

So sti("9.33") will return 9, stf("9.33") will return 9.33 and presumable you don't call sti("cannonballs") although some value would appear?
Pretty much. Generally you use them on any attributes because those are always stored as a string.

pps No internet but I may look through the Artois Voysey files at that pesky looping quest.
No internet is annoying. Had that last week. But thanks for your help! :cheers
 
I think the "while" loop changes work. Started the game as a Spanish Navy Officer and managed to go up to 10 cannons skill in one go.
It did seem excessively fast, but no more 100+% so that is at least a step in the right direction....
 
Oops, better use this instead:
Code:
  int nextSkill = 50000;
   while (curSkill >= nextSkill) // PB: Keep doing this while necessary
   {
     nextSkill = 50000; // PB: Reset
     if(curSkill==nextSkill) curSkill = 0;
     if(curSkill>nextSkill) curSkill = makeint(curSkill-nextSkill);
     if(sti(_refCharacter.skill.(expName)) < SKILL_MAX)
     {
       _refCharacter.skill.(expName) = sti(_refCharacter.skill.(expName)) + 1;
       if (iRealismMode == 0 && LogsToggle >= LOG_NORMAL && IsInParty(GetMainCharacterIndex(), sti(_refCharacter.index))) { // KK
         Log_SetStringToLog(GetMySimpleName(_refCharacter) + " " + TranslateString("","Gained") + " " + XI_ConvertString("skill_level") + " " + XI_ConvertString(expName) + " - " + sti(_refCharacter.skill.(expName)));
       }
     }
   }
We still need to initialize the value; otherwise you get CRAZY amounts of skill increases all the time.
This seems to put things back to normal.

I think @pedrwyth already caught that one, but I didn't notice until now. :facepalm

Anyway, that at least normalize some stuff again for Beta 3.5 .
 
Back
Top