I believe I have found a way to set special ship type to certain country, such as Ship_Victory only to England, and Ship_Dutchlineship only to Holland. I put the code into "\ships\ships.c", and change the existing function "void SetRandomNameToShip(ref rCharacter)" a little.
The original function:
I add the following code before "}":
It is an alternate approach anyway, but it seems to work just fine, and so far no known side-effect. The "SetRandomNameToShip()" is used in "\SEA_AI\sea.c", so it works for the worldmap encounter. It also works for Gold Fleet, bountyhunter, island ship(They are all located in "\scripts"). As for siege ship, just move the "SetRandomNameToShip" line below the following "GenerateShip" line.
I am also trying to make the wind direction the same as the world map wind direction when you enter the sea mode. I fail to locate any code which describe the wind in worldmap. Anyone could help?
EDIT: It seems to me that I may have solve the problem that wind directions in world map and sea mode are different. Although I do not understand clearly how this work, so it may have some undiscovered bugs.
In the file "\Weather\WhrWeather.c", there are several lines:
...
fWeatherAngle = stf(Weather.Wind.Angle);
//fWeatherAngle = GetAngleY(stf(worldMap.WindX), stf(worldMap.WindZ));
fWeatherSpeed = stf(Weather.Wind.Speed);
...
I remove the quotation note "//", and tried in game many time, the wind direction in both mode now seems to be the same all the time.
The original function:
Code:
void SetRandomNameToShip(ref rCharacter)
{
...
rCharacter.Ship.Name = GetRandSubString(rMassiveOfNames[rand(iMassiveOfNamesSize-2)]);}
Code:
ref rRealShip = GetRealShip(sti(rCharacter.Ship.Type));
switch (rRealShip.BaseName)
{
case "MANOWAR":
if (rCharacter.nation == ENGLAND) rCharacter.Ship.Type = GenerateShip(SHIP_VICTORY, true);
if (rCharacter.nation == FRANCE) rCharacter.Ship.Type = GenerateShip(SHIP_SOLEYRU, true);
break;
case "LINESHIP":
if (rCharacter.nation == HOLLAND) rCharacter.Ship.Type = GenerateShip(SHIP_DUTCHLINESHIP, true);
break;
}
if (rCharacter.nation == PIRATE)
{
if (rand(1000) < 750)
{
int PIRATESHIP;
switch (rRealShip.Class)
{
case "2":
PIRATESHIP = SHIP_SALAMANDER + rand(makeint(SHIP_MERMAIDGRIEF - SHIP_SALAMANDER));
rCharacter.Ship.Type = GenerateShip(PIRATESHIP, true);
break;
case "4":
PIRATESHIP = SHIP_BRIGQEEN + rand(makeint(SHIP_XebekVML - SHIP_BRIGQEEN));
rCharacter.Ship.Type = GenerateShip(PIRATESHIP, true);
break;
}
}
}
ref rRealShipNew = GetRealShip(sti(rCharacter.Ship.Type));
rCharacter.Ship.HP = rRealShipNew.HP; //<-- END
I am also trying to make the wind direction the same as the world map wind direction when you enter the sea mode. I fail to locate any code which describe the wind in worldmap. Anyone could help?
EDIT: It seems to me that I may have solve the problem that wind directions in world map and sea mode are different. Although I do not understand clearly how this work, so it may have some undiscovered bugs.
In the file "\Weather\WhrWeather.c", there are several lines:
...
fWeatherAngle = stf(Weather.Wind.Angle);
//fWeatherAngle = GetAngleY(stf(worldMap.WindX), stf(worldMap.WindZ));
fWeatherSpeed = stf(Weather.Wind.Speed);
...
I remove the quotation note "//", and tried in game many time, the wind direction in both mode now seems to be the same all the time.