• 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 Skill Bonuses not working for Equippable Items

jsv

Freebooter
Storm Modder
@Levis, it that game I've started yesterday with your stuff installed I'm not receiving +1 to sailing from a normal compass. Other equipment bonuses work ok and are nicely shown in full color, but the compass doesn't seem to point North anymore. :) Have you done something about navigation equipment? I remember there being a discussion...
 
@Levis, it that game I've started yesterday with your stuff installed I'm not receiving +1 to sailing from a normal compass. Other equipment bonuses work ok and are nicely shown in full color, but the compass doesn't seem to point North anymore. :) Have you done something about navigation equipment? I remember there being a discussion...

haven't done anything about that.
Got a savegame?

Did you equip it?
 
@Levis, it that game I've started yesterday with your stuff installed I'm not receiving +1 to sailing from a normal compass. Other equipment bonuses work ok and are nicely shown in full color, but the compass doesn't seem to point North anymore. :)
Do you have it equipped?

Do you have any other items that give a boost to Sailing skill? If so, try putting that in a chest and taking it out again.
I may have a clue on what is happening, but that has nothing to do with @Levis' recent work.
Rather, I'd expect it to be related to this: Medium Priority - Skills: System Rewrite for Performance | PiratesAhoy!

My suspicion is that you GET the "compass skill item", but the Sailing skill isn't updated because you haven't got it equipped.
Then when you equip it, the Sailing skill isn't updated, because it stored the modifier earlier and I don't think I ever added any code to reset it when you equip/de-equip a skill item.
The chest in/out the trick on another item that gives a Sailing bonus should force the item skill modifier to update.

There is also a console command to do the same, but I can't check the syntax now as I'm not near my game.
It is something like ResetSkillModifier(PChar, SKILL_SAILING); and can be found in PROGRAM\Leveling.c .

Have you anything about navigation equipment? I remember there being a discussion...
Nothing was done there yet. :no
 
I have it equipped, and I see corresponding HUD at sea. I'm attaching the save.
It has another intriguing property: when I load it, make a new save and then load the new save, my sailing skill goes up by 2-4%. I'm well on my way to becoming the best sailor in the world by mashing f5-f6-f5-f6... :aar
 

Attachments

  • -=Alfonso=- QuickSave 29.zip
    706.9 KB · Views: 77
I have it equipped, and I see corresponding HUD at sea. I'm attaching the save.
It has another intriguing property: when I load it, make a new save and then load the new save, my sailing skill goes up by 2-4%. I'm well on my way to becoming the best sailor in the world by mashing f5-f6-f5-f6... :aar
Only your sailing skills goes up?
 
@Pieter Boelen the cap on skill increase is a total of 4 or per skill?
Because I think that's the problem here. He has more then 4 skill increase points :p.

edit: never mind just removed some items and it still doesn't work so other problem here
 
Will look into it more :).
Btw nice list of opium buyers you have XD who would have know the leader of the pirates would also be a opium dealer XD
 
Maybe something wrong with the compass item itself? I remember that when I was buying this compass it wasn't equipped automatically instead of a cheaper one. But I'm not sure if it's normal.
 
@Levis: Are you quite sure that 'SkillCharMod' code of yours is quite correct?
I'm looking at it a bit now and find myself a bit confused.

What is the purpose of this function?
Code:
int CalcCharacterCharMod(ref character, string skillName)
{
   return 0;
}
And should this one not call ResetEffectiveSkill?
Code:
void ResetSkillCharMod(ref character, string skillName)
{
   character.skill.(skillName).charmod = 0;
   ResetShipSkill(character, skillName); //Just to be sure
}
That one resets all levels below it, but it does not go the other way.

There is also a console command to do the same, but I can't check the syntax now as I'm not near my game.
It is something like ResetSkillModifier(PChar, SKILL_SAILING); and can be found in PROGRAM\Leveling.c .
Yep, I was EXACTLY right. Execute that through console and immediately it updates.

I'm not actually surprised; I don't remember adding that function to the equip/de-equip functionality, which probably means that it isn't there.
So don't worry about this one @Levis; it isn't your doing and fixing it should be simple enough. I just need a bit more time before actually doing it....
 
I used to have a section of code in TakeNItems that would reset the item skill modifiers for a character when you get/lose any items.
To fix this one too, I made that into its own function:
Code:
void UpdateSkillModifierFromItem(ref _refCharacter, string itemName)
{
   aref arItm;
   Items_FindItem(itemName,&arItm);
   if(CheckAttribute(arItm, "skill"))
   {
     for(int sn = 0; sn < 10; sn++)
     {
       string skillName = GetSkillName(sn);
       if (CheckAttribute(arItm, "skill." + skillName))
       {
         ResetSkillModifier(_refCharacter, skillName);
       }
     }
   }
}
This is now called additionally from RemoveCharacterEquip and EquipCharacterByItem (for both old AND new items).

Extract attached file to PROGRAM\Characters to try. As far as I can tell, this works as intended now.
On @jsv's savegame, just de-equip the Compass and equip it again to update the number correctly.
 

Attachments

  • CharacterUtilite.zip
    32.9 KB · Views: 70
@Levis: Are you quite sure that 'SkillCharMod' code of yours is quite correct?
I'm looking at it a bit now and find myself a bit confused.

What is the purpose of this function?
Code:
int CalcCharacterCharMod(ref character, string skillName)
{
   return 0;
}

Yes it's correct.

And should this one not call ResetEffectiveSkill?
Code:
void ResetSkillCharMod(ref character, string skillName)
{
   character.skill.(skillName).charmod = 0;
   ResetShipSkill(character, skillName); //Just to be sure
}
That one resets all levels below it, but it does not go the other way.
I believe this should be enough. But feel free to change it to ResetEffectiveSkill. But from my testing this one seemd to be enough for every situation I could think off.
 
I believe this should be enough. But feel free to change it to ResetEffectiveSkill. But from my testing this one seemd to be enough for every situation I could think off.
GetCharacterSkill = GetCharacterBaseSkill + GetCharacterCharMod .
CalcEffectiveSkill saves its actual resulting value to character.Skill.(skillName).effective .
Therefore, if CharMod is updated, EffectiveSkill is NOT updated unless it is reset first.
But ResetShipSkill does not do that.

This is specifically to avoid more calculation than necessary as that caused the continuous performance issues in 3D sailing mode.
The "effective", "party" and "ship" levels are NOT actually 'modifiers' but different levels of skills.
So if you want to read the "ship" level, you just immediately read that attribute without looking at anything else.

All this is perfectly fine, as long as it is reset when it needs to be.
The opening post is a clear example of a situation where it wasn't reset when it did need to be.
 
will do some more testing with it this wednesday to make sure it works all as it should.
 
I used to have a section of code in TakeNItems that would reset the item skill modifiers for a character when you get/lose any items.
To fix this one too, I made that into its own function:
Code:
void UpdateSkillModifierFromItem(ref _refCharacter, string itemName)
{
   aref arItm;
   Items_FindItem(itemName,&arItm);
   if(CheckAttribute(arItm, "skill"))
   {
     for(int sn = 0; sn < 10; sn++)
     {
       string skillName = GetSkillName(sn);
       if (CheckAttribute(arItm, "skill." + skillName))
       {
         ResetSkillModifier(_refCharacter, skillName);
       }
     }
   }
}
This is now called additionally from RemoveCharacterEquip and EquipCharacterByItem (for both old AND new items).

Extract attached file to PROGRAM\Characters to try. As far as I can tell, this works as intended now.
On @jsv's savegame, just de-equip the Compass and equip it again to update the number correctly.
While the continued posts may suggest otherwise, I do believe I have FIXED the issue reported by the opening post.
See the attachment to that(^) post of mine above. @jsv, please test it. :doff
 
I'm calling this one Fixed since it works fine for me.

@jsv: If you do get the chance, I would appreciate if you could try it too.
 
Well, as the update forces a new game, let's just consider it fixed. If not, it's bound to reappear soon enough.
 
If you reduce the save value at the bottom of globals.c by 0.001, you can load your saves again. ;)
 
Back
Top