• 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 Ability Points while Scrolling through Character Interface

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
Another curiosity: I used "Fake Level Up" to give myself a bunch of extra levels. 41 to be exact. So I got 42 ability points to spend.
I then did NOT do the same on Lieutenant Bush. So obviously I was rather surprised when I noted this:
upload_2015-11-26_23-17-57.png


Further investigation revealed that this was NOT true.
If I scroll RIGHT through the characters, that number updates correctly.
But if I scroll LEFT, then I get to see that instead.

Try from attached savegame. Just load it, open the Characters interface and scroll both ways. o_O
 

Attachments

  • -=Player2=- Cayman. Grand Cayman shipyard June 23rd, 1798 1.zip
    711.3 KB · Views: 53
@Levis: Just wanted to double-check if you had seen this one.
I assume it should be a quick fix, but it is still weird and should be done of course.... :oops:
 
I might have an idea why this could happen and by my logic, it is actually wrong BOTH ways.

Refer to this simplified code:
Code:
   nFreeSkillPoints = sti(xi_refCharacter.Skill.FreeSkill);
   int nFreeAbilities = 0;
   if( CheckAttribute(xi_refCharacter,"perks.FreePoints") )
     nFreeAbilities = sti(xi_refCharacter.perks.FreePoints);
[...]
  if(CheckAttribute(xi_refCharacter,"perks.FreePoints")) GameInterface.strings.FreeAbilitiesPoints = sti(xi_refCharacter.perks.FreePoints); // MAXIMUS interface MOD
  GameInterface.strings.FreeSkillPoints = nFreeSkillPoints;

So what happens if a character does NOT have the "perks.FreePoints" attribute AT ALL?
nFreeAbilities is set to 0
nFreeAbilities is then NOT set to the correct number (because there isn't one), so remains set to 0.
The game then checks if the character has the attribute (for a second time) and only updates the text on the screen if there is.

Note how nFreeAbilities actually IS being updated correctly, but then IS NOT USED!
So the fix might be as simple as replacing this:
Code:
if(CheckAttribute(xi_refCharacter,"perks.FreePoints")) GameInterface.strings.FreeAbilitiesPoints = sti(xi_refCharacter.perks.FreePoints); // MAXIMUS interface MOD
With this:
Code:
GameInterface.strings.FreeAbilitiesPoints = nFreeAbilities;
Which makes the full code:
Code:
   nFreeSkillPoints = sti(xi_refCharacter.Skill.FreeSkill);
   int nFreeAbilities = 0;
   if( CheckAttribute(xi_refCharacter,"perks.FreePoints") )
     nFreeAbilities = sti(xi_refCharacter.perks.FreePoints);
[...]
  GameInterface.strings.FreeAbilitiesPoints = nFreeAbilities;
  GameInterface.strings.FreeSkillPoints = nFreeSkillPoints;
Note how nicely that matches with the skill-related code!
Which suggest that it must have been correct at some point in the past.
 
I tested my above fix and it works fine.

One query though @Levis: Should it be possible for a character to not have the "perks.FreePoints" attribute at all?
Because apparently it is.
 
I tested my above fix and it works fine.

One query though @Levis: Should it be possible for a character to not have the "perks.FreePoints" attribute at all?
Because apparently it is.
shouldn't be possible anymore. probably was put there in the past because it generated some errors. but I now check all characters so it shouldn't happen anymore
 
shouldn't be possible anymore. probably was put there in the past because it generated some errors. but I now check all characters so it shouldn't happen anymore
That's what I thought. But Bush clearly didn't have the needed attribute, or I would never have seen this issue.
And that was with the very latest modpack version.
 
Back
Top