It seems that the game likes to randomly apply upgrades for free to ships.
We should disable that for all ships except randomly encountered ones.
In PROGRAM\SEA_AI\AIFantom.c find:
Replace with:
This will make ALL ships encountered the Flying Dutchman. Replace with whatever ship you want to encounter.
This will make zero sense of course, especially when you encounter a French fleet of them.
But hey, you asked for it!
We should disable that for all ships except randomly encountered ones.
In PROGRAM\SEA_AI\AIFantom.c find:
Code:
int Fantom_GetShipType(int iClassMax, int iClassMin, string sShipType, int iNation) // NK
{
int iShips[2]; // was 512 - must be careful!!!!
SetArraySize(&iShips, SHIP_TYPES_QUANTITY*10); // new version of chance
int i, iShipsNum, iClass;
for(i = 0; i < SHIP_TYPES_QUANTITY*10; i++) iShips[i] = INVALID_SHIP_TYPE;
// NK -->
int shipnation = -1;
float NatSkipChance;
ref rShip;
if(iNation == PIRATE) { NatSkipChance = NOSKIP_CHANCE_WRONGNATION_PIRATE; }
else { NatSkipChance = NOSKIP_CHANCE_WRONGNATION; }
if(sShipType == "pirate")
{
if(PIRATES_USE_BOTH_TYPES) { sShipType = ""; }
else { sShipType = "war"; }
}
iShipsNum = 0;
// move class clamps things to Force_... 05-05-11
for (i=0; i<SHIP_TYPES_QUANTITY; i++)
{
rShip = GetShipByType(i); // why was this type object? 05-05-11
iClass = sti(rShip.Class);
if (iClass > iClassMin) { continue; }
if (iClass < iClassMax) { continue; }
if (sti(rShip.CanEncounter) != true) { continue; }
// KK: Periods -->
if (iNation >= 0 && iNation < NATIONS_QUANTITY) {
string sNation = GetNationNameByType(iNation);
if (sNation == "britain") {sNation = "england";} // Screwface : Fix for other nations type under English flag
if (CheckAttribute(rShip, sNation) == true && stf(rShip.(sNation)) < FRAND(1.0)) continue;
}
string sPeriod = GetCurrentPeriod();
if (CheckAttribute(rShip, "period."+sPeriod) && stf(rShip.period.(sPeriod)) < FRAND(1.0)) continue;
// KK: Periods <--
// new version of chance - old was if(CheckAttribute(rShip,"chance")) { if(frnd() > stf(rShip.chance)) { continue; } } // 04-09-10 will skip if chance not met
// NK mod so we can disregard shiptype if we want to: 04-09-04
// LDH --> new fix for missing sShipType 03Sep06
// if(sShipType != "") { if (!sti(rShip.Type.(sShipType))) { continue; } } // Original NK code
if(sShipType != "")
{
if (CheckAttribute(rShip, "Type."+sShipType))
{
if (!sti(rShip.Type.(sShipType))) continue;
}
else
{
trace("Fantom_GetShipType(): Ship " + rShip.id + " has no shiptype");
continue;
}
}
// LDH <--
// NK -->
if(CheckAttribute(rShip,"Nation") && iNation != -1)
{
shipnation = sti(rShip.Nation);
if(shipnation != iNation && frnd() > NatSkipChance) { continue; }
}
iShips[iShipsNum] = i;
iShipsNum++;
}
if (iShipsNum==0)
{
Trace("Can't find ship type '" + sShipType + "' with ClassMin = " + iClassMin + " and ClassMax = " + iClassMax);
return INVALID_SHIP_TYPE;
}
i = rand(iShipsNum-1);
while(i > 0 && iShips[i] == INVALID_SHIP_TYPE) i--;
return iShips[i];
}
Code:
int Fantom_GetShipType(int iClassMax, int iClassMin, string sShipType, int iNation) // NK
{
return GetShipIndex("FlyingDutchman");
}
This will make zero sense of course, especially when you encounter a French fleet of them.
But hey, you asked for it!