• 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!

Unconfirmed Bug Perk problems

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
While lookin into the problem of leeches, I noticed something in "PROGRAM\Loc_ai\LAi_character.c", function 'LAi_AllCharactersUpdate':
Code:
if(CheckPerkForGroup(chr_ai, "DefendPoison")) multip -= 0.5; //party wide
if(IsCharacterPerkOn(chr_ai, "Toughness")) multip -= 1;
That's not going to work because 'CheckPerkForGroup' wants the character whereas "chr_ai" is an attribute of the character. I replaced it with "chr" and it then seemed to work. But then I found that in "PROGRAM\Characters\perks\perks.c", a lot of different functions have their original code commented out and now they all call 'CheckPerkForGroup' instead, e.g.:
Code:
bool CheckCharacterPerk(ref chref, string perkName)
{
    /*if(isOfficerPerk(chref, perkName)) //Only when the perk is in the scope of this character
    {
        if (CheckPerkAvailable(perkName)) //Levis disable perks
        {
            if( CheckAttribute(chref,"perks.list."+perkName) ) return true;
        }
    }
    return false;*/
    return CheckPerkForGroup(chref, perkName); //Levis
}
The outcommented code is a straight copy of 'CheckPerkForSingleCharacter' (apart from using "chref" instead of "character" for the argument name), and you'd think a function named 'CheckCharacterPerk' is checking the specific character, not the whole group. I've changed 'CheckCharacterPerk' to call 'CheckPerkForSingleCharacter' instead, then used Windows Search to look for 'CheckCharacterPerk' and change it to 'CheckPerkForGroup' where it should indeed be checking the whole group.

@Jack Rackham: there are several calls on 'CheckCharacterPerk' in your "Woodes Rogers" code. I haven't changed any of these, so they'll now be checking the character alone, not the party. As far as I can tell, that's probably your intent anyway, e.g. in "PROGRAM\INTERFACE\itemsbox.c", there's code dealing with "drawing_kit" which checks various perks and then deletes them from the player character. If the perks are contributed by an officer and the player doesn't have them himself, deleting them from the player character won't do anything, so I'm guessing that checking for the player character alone is sufficient. In "Woodes Rogers" quest code, case "cannon_tower", several combat-related perks are checked; it probably doesn't matter whether the individual or group is checked because those perks can't be contributed anyway. Perhaps you'd like to check for yourself which perk-checking functions you're using, what they're doing in "perks.c", and whether they're really doing what you want?

None of this is in the current update, I only found out about it in the last couple of days!
 
The last time I played some of the involved parts, like cannon tower (cave_shore) it all worked as intended.
Also when given perks as a reward from some famous pirate captains. Drawing_kit is nothing important but was there all right.

As far as I can tell, that's probably your intent anyway
Yes, all those were meant for pchar.
 
Back
Top