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

Solved Cannot fast travel after sinking a ship in GOF 1.2?

Miguel Sanchez

Landlubber
I'm sure I'm not the only one who has experience this bug.

Description:
When you sink a ship, whether by bombing it or boarding it, and you use fast travel to a friendly ship or an island the ship re-spawn at the same place. In a hurry, GO TO SOLUTION SECTION.

Specific description:
I was looking why and the problem reside in file AISea.c function void SeaAI_SailToEndFade()
I found that a variable storing the number of ships (iNumShips) after killing some did not decreased and the Id (int iCharIndex = Ships[ -1] ) of the sunk ship was -1. Then the script to fast travel try to access an array using as index -1, throwing index out of bound error. The problem is, that it is not possible to see this error because a new event is created and if it fails it doesn't crash the game.

You can print the iCharIndex to see what I'm talking about. Just use this function to print Log_SetStringToLog("iCharIndex: " + iCharIndex);

Solution:

File: AISea.c
Function: void SeaAI_SailToEndFade()

for (int i=0; i<iNumShips; i++)
{
int iCharIndex = Ships[ -1 ];
if (iCharIndex == -1)
continue;

if (CheckAttribute(&Characters[iCharIndex], "SeaAI.Group.Name") && Characters[iCharIndex].SeaAI.Group.Name == PLAYER_GROUP) // fix
{
SendMessage(&Characters[iCharIndex], "l", MSG_SHIP_RESET_TRACK);
}
}


To solve this bug you just need to add and extra condition in the function as marked in red
 
Last edited:
Back
Top