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

Mod Release Special Perks and interface improvements

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
This will add the special perks for the gunner and doctor and it improves some of the interface features of the perks to make it easier to understand.
It also adds the rigging perk
Included in my own files but extracted for @Grey Roger
 

Attachments

  • Perks Fixes.zip
    1.2 MB · Views: 281
@Grey Roger here is a new version. This includes the new images done by @Jack Rackham and a small bugfix I noticed while testing the architect perk.
It also add's the architect perk
 

Attachments

  • Perks Fixes V2.zip
    1.5 MB · Views: 241
I really like these new perk icons:
Rigging (2), Firstaid/CureInjuries (3), DamageControl (3) AmmunitionRestock (1). :onya
 
Those are part of @Levis' work and not included in my update archive. In any case, First Aid and Cure Injuries do not give the surgeon anything new, they replace the existing Ship Defence perks.

Once we have a new installer based on what is known to work, I might look at the new perks.
 
As I recall, there was a report of someone (@ANSEL?) testing this and finding that it messed up existing perks, perhaps causing loss of perks which had already been bought. There's certainly some code including new functions which I'm reluctant to include.

What I have been doing is looking to incorporate the bits which deal with replacing the general purpose "Ship Defence" perks with the new specific "Damage Control", "Rigging" and "First Aid" perks. This looks fairly straightforward, being just a change of perk definitions in "perks_init.c", tweaks to some files to apply the relevant perks to reducing various types of damage, and changing the names of perks assigned in some character definitions.

The first question is, do people want this, or do we want to keep the existing "Ship Defence" perks?
 
As I recall, there was a report of someone (@ANSEL?) testing this and finding that it messed up existing perks, perhaps causing loss of perks which had already been bought.
Yes that's true, it was back in 2016, so I don't remember much. I have a lot of trouble with Levis new perks,one thing I
remember: If you set the perks to unlocked and the cost to one, it all goes crazy.
 
OK, this is going to be a bit more complicated than I thought. If I read the modified code correctly, none of the new defence perks will work correctly!

In "PROGRAM\BATTLE_INTERFACE\BattleInterface.c":
Code:
           if (sti(GetAttribute(damage_chr, "TmpPerks.Rigging")))            pMultiply = 0.8; // -20%
           if (sti(GetAttribute(damage_chr, "TmpPerks.RiggingAdvance")))   pMultiply = 0.6; // -40%
This is part of the code for calculating damage to sails. Setting aside that this is using different attributes to the original code (and accessing them directly rather than through functions, the opposite of what I was instructed to do when developing "Ardent" :p), this code sets the factor 'pMultiply' depending on which "rigging" perk, if any, the character has - and then doesn't use it.
In "PROGRAM\SEA_AI\AIShip.c":
Code:
    float pMultiply = 1;
   if (sti(GetAttribute(rCharacter, "TmpPerks.Rigging")))            pMultiply = 0.8; // -20%
   if (sti(GetAttribute(rCharacter, "TmpPerks.RiggingAdvance")))   pMultiply = 0.6; // -40%

   fDamage = Clampf(fDamage*pMultiply);

   // if mast fall - play sound
   if (fDamage >= 1.0)
   {
       Play3DSound("mast_fall", x, y, z);
...
'fDamage' has previously been set to 1.0 if a mast is supposed to have been knocked down. Applying the multiplier there means that if 'fDamage' was set to 1.0 and the character has a "Rigging" perk then 'fDamage' is reduced - which means if the mast was supposed to fall down, it won't fall now. The original code doesn't take ship defence perks into account when calculating mast damage.

Also in "AIShip.c":
Code:
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.BasicBattleState")))            fMinus = 0.08; //0.15
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.AdvancedBattleState")))         fMinus = 0.15; //0.25
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.ShipDefenceProfessional")))   fMinus = 0.25; //0.40
This is part of the code to calculate hull damage. The one place where the new damage control perks are needed, they haven't been put into place.

And the new first aid perks aren't mentioned at all, except in the code to calculate crew losses from musket fire.

All of which means sail damage, hull damage and crew damage don't take account of the new perks.

To fix these, I've rewritten those parts of "BattleInterface.c" and "AIShip.c". "BattleInterface.c" will use the same code as the original, just substituting "Rigging" for "BattleState" (and removing part of it because there are only two levels of "Rigging" as opposed to three levels of "BattleState":
Code:
       if( IsCharacterPerkOn(damage_chr,"RiggingAdvance") ) { fDmgRig *= 0.6; }
       else
       {
           if( IsCharacterPerkOn(damage_chr,"Rigging") )  { fDmgRig *= 0.8; }
       }
"AIShip.c" will not use the "Rigging" perks for mast damage. "BattleState" will be replaced by "DamageControl" for hull damage. And "FirstAid" will be used for crew damage:
Code:
    if (USE_REAL_CANNONS)
   {
       fMultiply = Bring2Range(1.0, 0.5, 0.0, 1.0, fskillDefence); // KNB was from 1.0x to 0.2x damage
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.BasicFirstAid")))           fMultiply *= 0.9 // 10% (15%)
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.AdvancedFirstAid")))         fMultiply *= 0.8 // 20% (30%)
   }
   else
   {
       fMultiply = Bring2Range(1.0, 0.2, 0.0, 1.0, fskillDefence);
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.BasicFirstAid")))           fMultiply *= 0.85 // 15%
       if (sti(GetAttribute(rOurCharacter, "TmpPerks.AdvancedFirstAid")))         fMultiply *= 0.7  // 30%
   }
All defence perks seem to have reduced effect if "USE_REAL_CANNONS" is set, so I'm doing likewise.

The doctor is about to be shortchanged. Currently he gets the three ship defence perks. Now the carpenter gets the three damage control perks, the navigator gets the rigging perks, and the doctor only gets two first aid perks. Perhaps set up a third level first aid perk? Otherwise, to compensate, I'm giving him "Iron Will" - this perks affects crew morale, which would certainly be improved if they know they'll be in the hands of a competent surgeon if they're wounded. Besides, this is the sort of surgeon who can say "You will lie down and take the pills - doctor's orders!" even to the captain.

You're probably going to need two navigators because one of them is going to be using up his ability points to build up towards "Sea Wolf"; the second can use his points on the "Rigging" perks. Or maybe give them to the first mate instead.
 
Last edited:
'fDamage' has previously been set to 1.0 if a mast is supposed to have been knocked down. Applying the multiplier there means that if 'fDamage' was set to 1.0 and the character has a "Rigging" perk then 'fDamage' is reduced - which means if the mast was supposed to fall down, it won't fall now.
Isn't that exactly what it is supposed to do? Assuming that the perk is checked for the captain of the applicable ship?
 
If you want characters with the "Rigging" perk to be immune to having their masts shot away, yes. Otherwise, no. ;) That's probably why the existing code doesn't take the ship defence perks into account when calculating mast damage. Besides, the "Rigging" perks are to be given to the navigator, which presumably means he's either steering the ship or changing the sails so that the sails present less of a target to the enemy. That won't help the masts as they're very tall, narrow cylinders, presenting the same target size from all angles.
 
If you want characters with the "Rigging" perk to be immune to having their masts shot away, yes. Otherwise, no. ;)
True. It looked to me like that was the intention of the original code, but that does seem like a bad intention, doesn't it?
 
The original code makes no use of the "BattleState" perks when calculating mast damage. Otherwise even basic ship defence (or basic "Rigging" now) becomes stupidly powerful, making your masts invincible.

If we do want the "Rigging" perks to apply to mast damage then the calculation needs to be earlier in function "Ship_MastDamage()". After some initial calculations, this does a switch based on damage type. Masts can be damaged by collision with an island, collision with a ship or cannonfire. I'm inclined not to apply any modifier for "Rigging" to damage by collision, at least not as long as the "Rigging" perks are associated with the navigator, because if the ship has just collided with an island or another ship then the navigator has fouled up and has not reduced damage! So that leaves us with cannonfire, handled by switch case SHIP_MAST_TOUCH_BALL. This calculates a damage multiplier based on the calibre of the cannon which scored the hit and the type of ammunition used. A piece of code could be inserted there to allow for the "Rigging" perks as another factor to that multiplier - before 'fDamage' is set to 1.0 to indicate that a mast has been knocked down by a critical hit.
 
This is about ready for testing by other people. I've been using it during my current play through the "Assassin" storyline and haven't noticed anything odd, but the numbers which govern the effectiveness of the perks may need tuning depending on whether they're ineffective or too effective when used on other ships.

Included are the specific "Damage Control", "Rigging" and "First Aid" perks replacing the original general "Ship Defence". Not included are the special perks or the functions associated with them, partly because I don't trust them but mainly because they're not needed; the same ends can be achieved by other means. For example, if we want to let people know that it's the gunner who is giving out free ammo, just change the on-screen message which appears when you get free ammo. ("RESOURCE\INI\TEXTS\ENGLISH\interface_strings.txt" already includes something suitable, so it may be that the message was originally "The Gunner has provided you with Ammunition!" "PROGRAM\QUESTS\quests_common.c" could easily be changed to use it.)

Note: if you copy the files from the zip into place, you'll need to start a new game. The original "Ship Defence" perks won't appear any more and other perks will probably be out of order if you try to continue an existing game.
 

Attachments

  • new_perks.zip
    757.5 KB · Views: 245
Not included are the special perks or the functions associated with them, partly because I don't trust them but mainly because they're not needed; the same ends can be achieved by other means.
I think the idea was to make that more obvious to the less-attentive players.
Personally I do like that idea, but it's not technically necessary.
 
My point was, you don't need special perks or perk functions to do that. You can tell the player that it's the gunner giving you free ammunition in the on-screen message about the free ammunition - and there's evidence that at one time the on-screen message did exactly that. It can easily enough be put back.

There's no point in having a perk or any other method to tell the player that only the surgeon heals after-battle casualties when, in fact, it is not only the surgeon who heals after-battle casualties. xD You heal some of them anyway; you do better if you have a surgeon or medicaments; and you get best results if you have both.
 
There's no point in having a perk or any other method to tell the player that only the surgeon heals after-battle casualties when, in fact, it is not only the surgeon who heals after-battle casualties. xD You heal some of them anyway; you do better if you have a surgeon or medicaments; and you get best results if you have both.
Huh, the player DOES? Since when?!?
That's not what I programmed it to do back in the days... :shock
 
Since - I don't know. There are settings in "InternalSettings.h" governing it:
Code:
#define HEALED_PER_DAY                   1       // INT - number of wounded crewmembers healed per day without doctor and medicines
#define HEALED_WITH_MEDS               5       // INT - number of wounded crewmembers healed per day if medicines are present
#define KILLED_PER_DAY                   16       // INT - number of wounded crewmembers that die per day without doctor and medicines
 
Back
Top