In PCW, the AI periodically sends attack waves against the player's base, starting with just a single Micro-Lynx. Below is the section of the code that's supposed to add more types of units to the attack waves as time passes, and the aiCount counter gets incremented.
// Check the count and increase the AI strength as needed
if (saveData.aiCount == 10 * saveData.diffMultiplier)
{
// Starflare time
saveData.aiMassGrp.SetTargCount(curType, mapStarflare, 3 - (saveData.diffMultiplier * 1.5));
}
else if (saveData.aiCount == 20 * saveData.diffMultiplier)
{
// Stickyfoam time
saveData.aiMassGrp.SetTargCount(curType, mapStickyfoam, 3 - (saveData.diffMultiplier * 1.5));
}
else if (saveData.aiCount == 30 * saveData.diffMultiplier)
{
// EMP time
saveData.aiMassGrp.SetTargCount(curType, mapEMP, 3 - (saveData.diffMultiplier * 1.5));
}
else if (saveData.aiCount == 45 * saveData.diffMultiplier)
{
// RPG time
saveData.aiMassGrp.SetTargCount(curType, mapRPG, 3 - (saveData.diffMultiplier * 1.5));
}
else if (saveData.aiCount == 70 * saveData.diffMultiplier)
{
// ESG time
saveData.aiMassGrp.SetTargCount(curType, mapESG, 3 - (saveData.diffMultiplier * 1.5));
}
else if (saveData.aiCount == 75 * saveData.diffMultiplier)
{
// Nova time
saveData.aiMassGrp.SetTargCount(curType, mapSupernova, 3 - (saveData.diffMultiplier * 1.5));
}
aiCount is an integer variable that gets incremented by 1 every cycle. In this section, diffMultiplier is used to make the changes happen faster on Hard than on Normal, and slower on Easy than on Normal.
On "Normal"difficulty level, it does just that, sending single Micro's up until ~mark 220 when it starts sending waves made up of one Micro and one Starflare. At ~mark 280 it starts sending waves made up of a Micro, a Starflare and a Sticky, and so on as time passes until it's sending waves made up of all seven unit types.
The problem is it only works on Normal. On both "Hard" and "Easy" difficulty levels, it just continues to send single Micro-Lynx waves throughout the entire game. When I first noticed the problem I assumed that it was something that I'd accidentally screwed up. Then, after wasting more than a week trying to find my mistake, I decided to test the original "Plymouth Cold War" (the one that comes bundled with the OPU version of Outpost2). I was surprised to find that the AI in the original behaves exactly as it does in my modded version. After squinting at the code and wracking my brains for more than two weeks, I finally think I've found the root of the problem in the following section of code which sets up the value of diffMultiplier.
Player[0].GoEden();
saveData.diffMultiplier = 0.7;
Player[0].MarkResearchComplete(techResearchTrainingPrograms);
Player[0].MarkResearchComplete(techOffspringEnhancement);
Player[0].MarkResearchComplete(techCyberneticTeleoperation);
if (Player[0].Difficulty() < 2)
{
saveData.diffMultiplier = 1;
Player[0].MarkResearchComplete(techLargeScaleOpticalResonators);
Player[0].MarkResearchComplete(techHighTemperatureSuperconductivity);
Player[0].MarkResearchComplete(techMobileWeaponsPlatform);
Player[0].MarkResearchComplete(techMetallogeny);
if (Player[0].Difficulty() < 1)
{
saveData.diffMultiplier = 1.3;
Player[0].MarkResearchComplete(techExplosiveCharges);
Player[0].MarkResearchComplete(techScoutClassDriveTrainRefit);
}
}
I think the problem is that there's no possible integer value multiplied times .7 that can ever exactly equal 10, 20, 30, etc... Same problem when you multiply by 1.3. Of course multiplying by 1.0 (the Normal level value for diffMultiplier) is no problem, so Normal level works as it should.
Does this sound right to you?