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

Setting maximum class for factions?

Swordsman422

Landlubber
Hello everyone.

I've been a LONG time player of the build mod and am enjoying b14.7 immensely.

I've modified the ships.init quite a great deal and am hoping to make the last 2 time periods an awful and challenging time to be a pirate. I have also removed entirely any ships above class 5 from pirate possession. Unfortunately, whil I'm playing the game I frequently run into pirate ships that are 4+ anyway. Specifically the pirates in the last 2 time periods seem to have an overwhelming number of Lineship47s at their disposal. As a test, I removed this ship from encounters and now the pirates are getting 3rd raters! Is there any way I can set the faction maximum rating to prevent pirates from using anything greater than 5th rate ships?

I will probably have many more questions later about likelihood of encountering particular numbers of ships, but I can save that for another day.

Thanks.
 
Try this in PROGRAM\InternalSettings.h:
Code:
#define MAXPIRATECLASS				2 			// INT - this is the maximum class ship pirates will be given. Defaults to 2.
 
Code:
#define MAXPIRATECLASS				2 			// INT - this is the maximum class ship pirates will be given. Defaults to 2.
That's completely bonkers! Pirates shouldn't be sailing anything like 2nd Rates! :shock

This is a very good point, and I'm glad it's been raised. I'd say that value should be changed to at least 4 as the default.
Of course, you can finely tune which ships pirates can use specifically with the encounter code in Ships_init.c, but a global value like this will be much more useful to give an immediate difference.
 
PB, I think it worked, but I'm still testing. Thanks for the input.

Armada, I tried editing the ships.init before with the aforementioned results; that the pirates kept bringing 3rd-raters to the game when I forbid them from having any.

I've gone into the encounters files and excluded the pirates from warship encounters as well. I'm still trying to figure out how to make it more likely to have single ship encounters i.e single merchantmen or a single warship no greater that rate 4 on patrol. I'd also like to reserve large encounters for the group of merchants and battle fleet types, and exclude all nations but the pirates in the rag-tag bunch types.
 
ohhh nice find Swordsman422, and nicely zoned in Pieter - hmm shall we change this in the files Armada? What would be the best value considering the ships we have available(as you know them very well)? Or maybe Swordsman422 has a suggestion as well. 4 sounds good, we can certainly set it to that and see how it goes?
 
It's definitely something we should change for the next release, I'd say. Pirates have long been encountered in high class ships as opposed to more realistic fleets of smaller vessels.
I think 4 could be a good cap on the class they can use, because that should restrict them to nothing bigger than a medium-sized galleon, hopefully.
It would be good to have a few people testing this in their games, to see if the pirate encounters are more appropriate.

Of course, we still need to make them less likely to use Xebecs. They're all over the place, and not hugely realistic for pirates to use, compared to brigs or schooners, for example.
 
Actually in the same section of code i've chaged it so pirates use merchant ships as well as warships:
Code:
#define PIRATES_USE_BOTH_TYPES     1

I've been playing with that for a while and it seems ok to look at(i generally run away from pirate ships so far) but not sure how it works out in terms of combat. I just wanted a wider variety of pirate ships.
 
If you set all chance values to 0 for the pirates for the higher classes,
the game will be unable to find a ship and then return a default ship instead.
Changing the max class value for pirates should hopefully work better and easier. :doff
 
Guys, I'm still having trouble with lineship47 showing up. I have removed it from encounters and purchases in the shipsinit and I'm still encountering it. Specifically when I encounter a "rag-tag bunch" of any nation, it is always there. I'm going to try removing the entry for it to see if that alleviates the issue.
 
Are you playing in PERIOD_THE_CORSICAN? If so, this could be the reason:
Code:
// PS -->
int Force_GetShipType(int maxclass, int minclass, string type, int nat)
{
//these are JUST IN CASE...
if(maxclass > minclass) {int tmp = maxclass; maxclass = minclass; minclass = tmp; } // NK to swap min/max if needed 05-04-15
// 04-09-09 NK-PRS3
if(type == "pirate")
{
if(PIRATES_USE_BOTH_TYPES) { type = ""; }
else { type = "war"; }
}
// NK <--
switch(type) // add this 05-05-01 for just in case.
{
case "trade":
maxclass = iclamp(MAXMERCHANTCLASS, MIN_CLASS, maxclass);
minclass = iclamp(MAXMERCHANTCLASS, MIN_CLASS, minclass);
break;

case "pirate":
maxclass = iclamp(MAXPIRATECLASS, MIN_CLASS, maxclass);
minclass = iclamp(MAXPIRATECLASS, MIN_CLASS, minclass);
break;
// default, war, where max class is MAX_CLASS
maxclass = iclamp(MAX_CLASS, MIN_CLASS, maxclass);
minclass = iclamp(MAX_CLASS, MIN_CLASS, minclass);
}

// Screwface
bool finish = false;
int end = 0; // Security to avoid infinite loop
while(!finish && end < 200) // maximum of 100 loop should be enough
{
int iShipType = Fantom_GetShipType(maxclass, minclass, type, nat);
if(iShipType < SHIP_TYPES_QUANTITY && iShipType >= 0)
{
finish = true;
}
else
{
end++;
}
}
if(finish){return iShipType;}
else
{
//	return GetCharacterShipType(GetMainCharacter());
// PB: If all fails, return a random period-specific ship type instead of the player ship -->
switch((GetCurrentPeriod()))
{
case PERIOD_EARLY_EXPLORERS:
switch(rand(1))
{
case 0: return GetShipIndex("caravol1"); break;
case 1: return GetShipIndex("caravel1"); break;
}
break;

case PERIOD_THE_SPANISH_MAIN:
switch(rand(2))
{
case 0: return GetShipIndex("fleut4"); break;
case 1: return GetShipIndex("pinnace1"); break;
case 2: return GetShipIndex("frigate6"); break;
}
break;

case PERIOD_GOLDEN_AGE_OF_PIRACY:
switch(rand(2))
{
case 0: return GetShipIndex("Barque4_47"); break;
case 1: return GetShipIndex("pinnace1"); break;
case 2: return GetShipIndex("frigate1"); break;
}
break;

case PERIOD_COLONIAL_POWERS:
switch(rand(2))
{
case 0: return GetShipIndex("Hannah_p1"); break;
case 1: return GetShipIndex("pinnace1"); break;
case 2: return GetShipIndex("frigate2"); break;
}
break;

case PERIOD_REVOLUTIONS:
switch(rand(2))
{
case 0: return GetShipIndex("ketch"); break;
case 1: return GetShipIndex("hooker1"); break;
case 2: return GetShipIndex("corvette1_47"); break;
}
break;

case PERIOD_THE_CORSICAN:
switch(rand(2))
{
case 0: return GetShipIndex("schooner4_50"); break;
case 1: return GetShipIndex("fastmerchantman"); break;
case 2: return GetShipIndex("lineship47"); break;
}
break;
}
// PB: If all fails, return a random period-specific ship type instead of the player ship <--
}

// old section outcommented
/*int iShipType = Fantom_GetShipType(maxclass, minclass, type, nat);
if(iShipType < SHIP_TYPES_QUANTITY && iShipType >= 0) { return iShipType; }
trace("oh no, we didn't find a ship the first go!");
iShipType = Fantom_GetShipType(maxclass, minclass, type, nat); // try again, for randomness
if(iShipType < SHIP_TYPES_QUANTITY && iShipType >= 0) { return iShipType; }
iShipType = Fantom_GetShipType(maxclass, minclass, type, -1); // clear nation
if(iShipType < SHIP_TYPES_QUANTITY && iShipType >= 0) { return iShipType; }
iShipType = Fantom_GetShipType(maxclass, minclass, "none", -1); // clear type too
if(iShipType < SHIP_TYPES_QUANTITY && iShipType >= 0) { return iShipType; }
iShipType = GetCharacterShipType(GetMainCharacter());
return iShipType;*/
}
In that case, it is actually my bugfix to prevent the player ship being generated instead that is causing this for you.
That's from PROGRAM\Ships\ships.c
 
Actually, PB, I am playing in that period. I would not at all mind having a duel with my doppleganger. Would this code you posted allow that?
 
Reinstate this line:
return GetCharacterShipType(GetMainCharacter());
(remove // in front of it)
Then remove the period switch code thingey.

We changed this code to prevent the player ship being generated for cases where you're playing, for example, with the Black Pearl or another unique ship.
 
Back
Top