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

Improve the Sea AI

If one ship in a group surrenders, the other ones in that group become neutral even though they shouldn't.
 
I haven't yet tested enough to give you an answer to that (I'm working on pennants, so starting a new game all the time),
but I'll keep an eye out for it.
 
I just started the Beatrice Devlin storyline on Spanish nationality.
When sailing around the Spanish island of Jamaica under Spanish colours, I got the message on-screen
"Captain, we're recognized!". What can I be recognized for if I'm flying my own nation's colours??? :shock
 
Oh i see what's going wrong. Here is the fix in CheckForMainCharacterfalseflag function (Screwface_functions.c) :

Code:
void CheckForMainCharacterfalseflag(ref chr, float range)
{
Ref Pchar = GetmainCharacter();
ref rgroup = Group_GetGroupByID(GetGroupIDFromCharacter(chr));
float distance;
int i = 0;
bool Recognized = false; // To avoid being recognized if we hoist our own nation flag

if (ENABLE_FLAGS == 1)
{
distance = Ship_GetDistance2D(Pchar, chr);
if(distance <= range)
{
int MyFlag = GetCurrentFlag();
float chance = 1 - (distance / range);
chance = 0.5 + chance; // 0.5 will be decreased if you are too easily recognized
//logit(" "+chance+" ");

if (iForceDetectionFalseFlag == 0) {
if ((frnd() >= (GetChanceDetectFalseFlag() * chance)) || (MyFlag == PERSONAL_NATION)) {
MyFlag = GetCurrentFlag();
} else {
MyFlag = PERSONAL_NATION;
Recognized = true;
}
}
if (iForceDetectionFalseFlag == 1)
{
MyFlag = PERSONAL_NATION;
Recognized = true;
}
if(Recognized==true && GetRMRelationType(GetActualRMRelation(sti(chr.nation))) == RELATION_ENEMY && !Checkattribute(chr,"recognized"))
{
chr.recognized = 1;
chr.EnemyShipName = Pchar.Ship.Name;
chr.EnemyShipType = Pchar.Ship.Type;
Log_SetStringToLog(TranslateString("", "We are recognized, captain!"));
SetCharacterRelationBoth(sti(chr.index), sti(Pchar.index), RELATION_ENEMY);
// Each ship of group must have recognized you just in case where leader would surrender or be destroyed
bool fini = false;
while (!fini)
{
int iCharacterIndex = Group_GetCharacterIndexR(rGroup, i); i++;
if(iCharacterIndex >= 0)
{
Characters[iCharacterIndex].recognized = 1;
Characters[iCharacterIndex].EnemyShipName = Pchar.Ship.Name;
Characters[iCharacterIndex].EnemyShipType = Pchar.Ship.Type;
}
else
{
fini = true;
}
}
UpdateRelations();
}
if(distance < 1000){Pchar.obsenemy ="1";}
}
}
}
 
Let's move this thread for everyone to see, considering it's included in the latest patches.
 
Back
Top