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

Sea encounter types

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
From the Screenshots thread:
Ah! Well, I don't think it's the only one.
And it actually looks to just about fit.


In PROGRAM\Encounters\Encounters_init.c you'll find this line a few times:
Code:
if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC) Enc_ExcludeNation(rEnc, HOLLAND);
And also in PROGRAM\QUESTS\quests_common.c:
Code:
    if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC)
    {
        if(sti(rFantom.nation) == HOLLAND        && maxclass < 3)                        maxclass = 3;
        if(sti(rFantom.nation) == PORTUGAL       && maxclass < 3)                        maxclass = 3;
    }
I'm not sure I understand the entries in "Encounters_init.c". If I read them correctly, there are some encounter types which don't limit Holland or Portugal, e.g.:
Code:
   makeref(rEnc, EncountersTypes[ENCOUNTER_TYPE_FLEET]);   // 0 + 4
   n++; rEnc.Skip = false;
   rEnc.Type = ENCOUNTER_WAR;
   rEnc.MinRank = 5;
   Enc_AddShips(rEnc, "War", 3, 4);
   Enc_ExcludeNation(rEnc, PIRATE);

   Enc_AddClasses(rEnc, 5, 0, 0, 2, 4);
   Enc_AddClasses(rEnc, 6, 0, 0, 1, 4);
   Enc_AddClasses(rEnc, 7, 0, 0, 1, 4);
   Enc_AddClasses(rEnc, 8, 0, 0, 1, 3);
   Enc_AddClasses(rEnc, 9, 0, 0, 1, 3);
   Enc_AddClasses(rEnc, 10,0, 0, 1, 2);
   Enc_AddClasses(rEnc, -1,0, 0, 2, 4); // NK for shipcap off
Why doesn't this cause problems due to a lack of big Dutch and Portuguese ships?

In any case, I may need to edit "Ships_init.c" to allow Portugal some big ships in "Early Explorers". Portugal certainly had some; it was the other main power of the time apart from Spain. For one thing, the most powerful Spanish ship in the game, "SP_BattleGalleon", alias San Martin, was originally the Portuguese São Martino until Spain and Portugal united and Spain decided it wanted the ship for their Armada. So either we block Portugal entirely in "Early Explorers" because it was united with Spain; or we restrict it in all periods because its main fleet was on the other side of the world; or we remove restrictions on Portugal in "Early Explorers" and allow it to share the same big ships that Spain uses. (Apart from "SP_ApostolFelipe" and, ironically, "SP_BattleGalleon" because those ship models have very Spain-specific decorations.)

At the other end of time, Holland can have at least some restrictions lifted if "NL_Superbe" goes into the game, though Holland probably didn't have enough of a fleet to warrant allowing the largest encounter types.
 
Why doesn't this cause problems due to a lack of big Dutch and Portuguese ships?
I'm digging deep into my memory here, so please forgive me if what I am about to say turns out to be incorrect.

If I recall, the "Enc_AddClasses(rEnc, -1" line is the one that is commonly used.
The other ones are for when the "encounter ship tier depends on the player ship tier (or was it level?)" is enabled.
That is disabled by default and, as far as I can tell, nobody ever uses that old stock game feature anymore.

Going further, this means "add between 3 and 4 warships in this encounter:
Code:
Enc_AddShips(rEnc, "War", 3, 4);
And this means "for the ship level mod OFF, the merchant ships must be between tier 0 and 0 (doesn't matter because there aren't any in this case) and the warships must be between tier 2 and 4".
This doesn't cause a problem because, while Holland doesn't have Tier 2 and 3 ships in some periods, it does always have at least one Tier 4 ship available.
In other words: The limitation on ship availability for Holland doesn't cause the game to search an empty array in this case.


In any case, I may need to edit "Ships_init.c" to allow Portugal some big ships in "Early Explorers". Portugal certainly had some; it was the other main power of the time apart from Spain. For one thing, the most powerful Spanish ship in the game, "SP_BattleGalleon", alias San Martin, was originally the Portuguese São Martino until Spain and Portugal united and Spain decided it wanted the ship for their Armada. So either we block Portugal entirely in "Early Explorers" because it was united with Spain; or we restrict it in all periods because its main fleet was on the other side of the world; or we remove restrictions on Portugal in "Early Explorers" and allow it to share the same big ships that Spain uses. (Apart from "SP_ApostolFelipe" and, ironically, "SP_BattleGalleon" because those ship models have very Spain-specific decorations.)

At the other end of time, Holland can have at least some restrictions lifted if "NL_Superbe" goes into the game, though Holland probably didn't have enough of a fleet to warrant allowing the largest encounter types.
If you have ways to improve on the status quo, go right ahead! I have no real loyalty to all this old code.
It was simply necessary to prevent the game code from messing up with the existing ship line-up as established by other forum members.
 
In that case, why does Napoleonic period Holland need to be excluded here?
Code:
// MILITARY - LOCAL PATROL (shallow waters) - Nations guarding their territorial waters
   makeref(rEnc, EncountersTypes[ENCOUNTER_TYPE_LPATROL]);
   n++; rEnc.Skip = false;
   rEnc.Type = ENCOUNTER_WAR;
   rEnc.Chance = 5;
   rEnc.MinRank = 1;
   Enc_AddShips(rEnc, "War", 2, 8);
   Enc_ExcludeNation(rEnc, PIRATE);
   if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC) Enc_ExcludeNation(rEnc, HOLLAND);
   if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC) Enc_ExcludeNation(rEnc, PORTUGAL);

   Enc_AddClasses(rEnc, 1, 0, 0, 5, 6);
   Enc_AddClasses(rEnc, 3, 0, 0, 4, 6);
   Enc_AddClasses(rEnc, 5, 0, 0, 3, 5);
   Enc_AddClasses(rEnc, 7, 0, 0, 3, 4);
   Enc_AddClasses(rEnc, 9, 0, 0, 2, 4);
   Enc_AddClasses(rEnc, 12,0, 0, 2, 3);
   Enc_AddClasses(rEnc, -1,0, 0, 2, 4); // NK for shipcap off
Does that not also add between 2 and 8 warships, between tier 2 and tier 4, which should still be fine because Holland has tier 4 ships?

That's probably the only encounter type which I'd want to add for Napoleonic Holland anyway. The larger fleet encounters wouldn't be appropriate, not due to ship type, but because Napoleonic period Holland didn't have a large fleet.
 
In that case, why does Napoleonic period Holland need to be excluded here?
Code:
// MILITARY - LOCAL PATROL (shallow waters) - Nations guarding their territorial waters
makeref(rEnc, EncountersTypes[ENCOUNTER_TYPE_LPATROL]);
n++; rEnc.Skip = false;
rEnc.Type = ENCOUNTER_WAR;
rEnc.Chance = 5;
rEnc.MinRank = 1;
Enc_AddShips(rEnc, "War", 2, 8);
Enc_ExcludeNation(rEnc, PIRATE);
if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC) Enc_ExcludeNation(rEnc, HOLLAND);
if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC) Enc_ExcludeNation(rEnc, PORTUGAL);

Enc_AddClasses(rEnc, 1, 0, 0, 5, 6);
Enc_AddClasses(rEnc, 3, 0, 0, 4, 6);
Enc_AddClasses(rEnc, 5, 0, 0, 3, 5);
Enc_AddClasses(rEnc, 7, 0, 0, 3, 4);
Enc_AddClasses(rEnc, 9, 0, 0, 2, 4);
Enc_AddClasses(rEnc, 12,0, 0, 2, 3);
Enc_AddClasses(rEnc, -1,0, 0, 2, 4); // NK for shipcap off
Does that not also add between 2 and 8 warships, between tier 2 and tier 4, which should still be fine because Holland has tier 4 ships?
How many Tier 4 ships does Holland have? And how many Tier 4 ships did Holland have at the time when that code was written?
I can't fully remember, but either Holland had no Tier 4 ships at the time; or it only had 1 leading to a fleet of 2-8 identical ships.
 
Not many, but that encounter allows for anything between tier 2 and tier 4. Looking through "Ships_init.c" for ships valid for Holland in "Napoleonic" period:
RN_Warship - tier 3
RN_Surprise - tier 4

And now NL_Superbe - tier 2

Perhaps give Holland low probability access to RN_Essex as well, as it did have some 44 gun frigates during the period.
(Edit: on second thoughts, don't give Holland access to RN_Essex. It already has NL_Essex. xD)
 
Last edited:
RN_Warship - tier 3
RN_Surprise - tier 4
In that case, I expect that Holland didn't have access to those two when we wrote that code, but someone (you?) decided to change that.

Anyway, the history doesn't matter. Holland does have them now, so feel free to enable the encounter if you like. :doff
 
Odd. Encounter types ENCOUNTER_TYPE_MERCHANT2 ("single merchant with heavy escort"), ENCOUNTER_TYPE_FLEET ("warships") and ENCOUNTER_TYPE_PUNITIVE_SQUADRON ("rag-tag bunch") also allow warships between tiers 2 and 4, don't exclude Holland or Portugal, and don't cause problems (apart, perhaps, from limited choices of types).

Anyway, I removed the block on "Napoleonic" period Holland for type ENCOUNTER_TYPE_LPATROL ("large patrol"), then started up a FreePlay as Jack Aubrey and went looking for trouble with the Dutch. The ships in an encounter are generated randomly when you exit from worldmap to sailing, so I saved game on the worldmap any time I found something Dutch, eventually found a large patrol, and after a few reloads to allow random chance to have a few attempts to assign the right ship:
nl_superbe.jpg nl_superbe_spyglass.jpg

I've also altered "NK.c" to allow the ship to be a promotion reward for high ranking Dutch naval officers.
 
Back
Top