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

Discussion Attempt at "ship battle simulator"

Lonious

Master Mariner
With @Grey Roger 's help, I managed to make a rudimentary "battle simulator" where you can easily build a fleet of 4 from the start and face off against 4 enemy ships in Cozumel/Khael Roa.

This has been on my mind for quite a while and I thought of sharing this with any of those who are also interested.

How to use:
1 - Backup console.c, SideQuest.c, quests_side.c, and Oweyn McDorey_dialog.c files and then replace them with the ones I uploaded.
2 - Enable Cheats in InternalSettings.h.
3 - Open Ships_init.c and find all the ships you want to assign your friends with - then set the "ShipCanEncounter" and "ShipCanBuy" lines to false. This enables you to buy them from Vanderdecken.
4 - Start a game which begins at Barbados island (I did this by using the Free Play and selecting Sailor with England as Nation).
5 - Talk to Oweyn McDorey in the shipyard, then quit the dialog. You get transported immediately to Vanderdecken with 3 Officers. You also receive several weapons,
armor, and bandages. Press Save for later use.
6 - Use Cheats to level up you and your officers as you please.
7 - From Vanderdecken buy the ships you edited in Ships_init.c and give them to you and your officers.
8 - Go to your ship's weapons locker and put swords, pistols, and armor there in case you intend to board. Equip your own sword, pistol, and armor.
9 - Go to Sea, then hit F12 to assign the proper cannons and max crew to your ships.
10 - Sail to the front of Cozumel island (the entrance). There you encounter a fleet of 4 French ships.

You can easily customise your enemies and their ships by opening SideQuest.c in the Characters folder. Look for "Enemy1". He and his buddies are automatically assigned several ships of the line which can be modified at will (use the Ship ID).

If you want to fight less than 4 opponents, put // before Group_AddCharacter in SideQuest.c case "shipfight". E.g.:

Group_AddCharacter("EnemyGroup", "Enemy1");
Group_AddCharacter("EnemyGroup", "Enemy2");
//Group_AddCharacter("EnemyGroup", "Enemy3");
//Group_AddCharacter("EnemyGroup", "Enemy4");

This means only Enemy1 and Enemy2 show up.

This "quest" can probably be improved in a few ways. For example, I'd like to have myself and my men transported immediately to some area near Cozumel so that the battle begins immediately after I leave the Vanderdecken shipyard, but I don't know how to do this (being a noob modder). If you have any suggestions, please comment here, but also do tell me how to do it as I am unable to function much on my own in regards to coding/modding.

Some shots I took;

Fight1.jpg

fight2.jpg

fight3.jpg

fight4.jpg
 

Attachments

  • Oweyn McDorey_dialog.c
    8.9 KB · Views: 94
  • quests_side.c
    651.4 KB · Views: 74
  • SideQuest.c
    194.7 KB · Views: 88
  • console.c
    35.4 KB · Views: 73
The "Friend" characters are all clones of Mergildo Hurtado, the Spanish captain from the "Strange Things Going On in the Caribbean" sidequest. He's set to have reputation "Bloody Terror", therefore so are all your friends. Unless your own reputation is on the evil side, they're going to mutiny pretty quickly! Change their 'ch.reputation' lines to "45", which is neutral, which means they should be safe regardless of your own reputation.

They won't need the 'ch.Ship.AI.GroupName', 'ch.Ship.AI.Task, 'ch.Ship.Name', 'ch.Ship.Type', 'ch.Ship.Stopped', 'ch.skipFalseFlag' or 'ch.nosurrender' lines. Their AI group will be yours as they're your companions, their task should be whatever you tell them to do, their ship will be whatever you give them, and companions don't care about false flags and never surrender.

You could make setting up the ships a lot easier. Don't edit "Ships_init.c", don't bother with Vanderdecken, and don't edit "SideQuest.c". Just put a few 'GiveShip2Character' lines into "console.c", right below the 'int limit' line:
Code:
    GiveShip2Character(PChar, "SP_Trinity", "Alpha", SPAIN, true, true);
    GiveShip2Character(CharacterFromID("Friend"), "PO_Poseidon", "Beta", SPAIN, true, true);

    GiveShip2Character(CharacterFromID("Enemy1"), "FR_Superbe", "Primus", FRANCE, true, true);
That assigns ships to yourself, "Friend" and "Enemy1". You can add lines for "Friend2", "Friend3", "Enemy2", "Enemy3" and "Enemy4". Change the ship types (e.g. "SP_Trinity", "PO_Poseidon" or "FR_Superbe") to whatever you want. Change the names (e.g. "Alpha", "Gamma" or "Primus") while you're at it. Then start your game, press F12 while you're not at sea and not in port, and everyone should have their ships set up.

As for teleporting to Cozumel, I'll first need to find a suitable sea locator to which you can teleport. Altertnatively, it would be easy enough to teleport you to Cozumel shore, but then you have to sail out through the narrow channel and your companions will probably have trouble following.
 
So, it looks like I've detected one problem. When I tried to board a ship, when the captain "surrendered" (you appear in the cabin with him alone and he's supposed to talk to you to either duel you or surrender) I couldn't talk to him. Perhaps I should put a "nosurrender" flag or something?

The "Friend" characters are all clones of Mergildo Hurtado, the Spanish captain from the "Strange Things Going On in the Caribbean" sidequest. He's set to have reputation "Bloody Terror", therefore so are all your friends. Unless your own reputation is on the evil side, they're going to mutiny pretty quickly! Change their 'ch.reputation' lines to "45", which is neutral, which means they should be safe regardless of your own reputation.
Ok.
They won't need the 'ch.Ship.AI.GroupName', 'ch.Ship.AI.Task, 'ch.Ship.Name', 'ch.Ship.Type', 'ch.Ship.Stopped', 'ch.skipFalseFlag' or 'ch.nosurrender' lines. Their AI group will be yours as they're your companions, their task should be whatever you tell them to do, their ship will be whatever you give them, and companions don't care about false flags and never surrender.
Will do this.
You could make setting up the ships a lot easier. Don't edit "Ships_init.c", don't bother with Vanderdecken, and don't edit "SideQuest.c". Just put a few 'GiveShip2Character' lines into "console.c", right below the 'int limit' line:
Code:
    GiveShip2Character(PChar, "SP_Trinity", "Alpha", SPAIN, true, true);
    GiveShip2Character(CharacterFromID("Friend"), "PO_Poseidon", "Beta", SPAIN, true, true);

    GiveShip2Character(CharacterFromID("Enemy1"), "FR_Superbe", "Primus", FRANCE, true, true);
That assigns ships to yourself, "Friend" and "Enemy1". You can add lines for "Friend2", "Friend3", "Enemy2", "Enemy3" and "Enemy4". Change the ship types (e.g. "SP_Trinity", "PO_Poseidon" or "FR_Superbe") to whatever you want. Change the names (e.g. "Alpha", "Gamma" or "Primus") while you're at it. Then start your game, press F12 while you're not at sea and not in port, and everyone should have their ships set up.
Sounds like a plan.
As for teleporting to Cozumel, I'll first need to find a suitable sea locator to which you can teleport. Altertnatively, it would be easy enough to teleport you to Cozumel shore, but then you have to sail out through the narrow channel and your companions will probably have trouble following.
Sure, please do update me if you find anything. Ideally it should be somewhere further from the island, because the enemy fleet already spawns near it - taking the fight between their fleet and the island sometimes results in my ships hitting the rocks.

This sounds like good advice. I'll try to implement these points and see how it goes.
 
Last edited:
So, it looks like I've detected one problem. When I tried to board a ship, when the captain "surrendered" (you appear in the cabin with him alone and he's supposed to talk to you to either duel you or surrender) I couldn't talk to him. Perhaps I should put a "nosurrender" flag or something?
Remove this line from all the "Enemy" definitions, and probably the "Friend" definitions as well:
Code:
LAi_SetActorType(ch);
That's probably what's preventing him from talking.

Adding a "nosurrender" flag would get around the problem in that the captain can't talk about surrendering if he's not allowed to surrender! xD
 
You could make setting up the ships a lot easier. Don't edit "Ships_init.c", don't bother with Vanderdecken, and don't edit "SideQuest.c". Just put a few 'GiveShip2Character' lines into "console.c", right below the 'int limit' line:
Code:
    GiveShip2Character(PChar, "SP_Trinity", "Alpha", SPAIN, true, true);
    GiveShip2Character(CharacterFromID("Friend"), "PO_Poseidon", "Beta", SPAIN, true, true);

    GiveShip2Character(CharacterFromID("Enemy1"), "FR_Superbe", "Primus", FRANCE, true, true);
That assigns ships to yourself, "Friend" and "Enemy1". You can add lines for "Friend2", "Friend3", "Enemy2", "Enemy3" and "Enemy4". Change the ship types (e.g. "SP_Trinity", "PO_Poseidon" or "FR_Superbe") to whatever you want. Change the names (e.g. "Alpha", "Gamma" or "Primus") while you're at it. Then start your game, press F12 while you're not at sea and not in port, and everyone should have their ships set up.
I've did just that, but nothing happens. In fact, the console won't execute anymore whenever I put those "GiveShip2Character" lines. Attached here is a screenshot of the console.c and the file itself.

Btw, please remove SetNextWeather if you plan to use this. This was so I could generate a gale during the fight.
 

Attachments

  • console notworking.c
    35.7 KB · Views: 86
  • console.jpg
    console.jpg
    130 KB · Views: 66
Last edited:
I've did just that, but nothing happens. In fact, the console won't execute anymore whenever I put those "GiveShip2Character" lines. Attached here is a screenshot of the console.c and the file itself.
Sorry, I goofed - I missed out a "-1" which gives the ship its default cannons. The correct lines should be, for yourself:
Code:
GiveShip2Character(PChar, "SP_Trinity", "Alpha", -1, SPAIN, true, true);
For a friend:
Code:
GiveShip2Character(CharacterFromID("Friend3"), "PO_Poseidon", "Delta", -1, SPAIN, true, true);
And for an enemy:
Code:
GiveShip2Character(CharacterFromID("Enemy1"), "FR_Superbe", "Primus", -1, FRANCE, true, true);
Changed the 'CharacterFromID' part to give a ship to another character. The nation in these lines doesn't affect the ship's flag, it affects the national modifiers for ship stats which you can find at the top of "Ships_init.c".

Now, as to locators. You can view locators using a program called TOOL:
http://piratesahoy.bowengames.com/Cloud/Tools/Modeling+Texturing/Inez Dias Tool.rar
There are locators in group "Quest_Ships" named "Quest_Ship_1", "Quest_Ship_2", etc., up to "Quest_Ship_8". Any of these should put you close to the enemy group which you're placing at "Quest_Ship_4", except for "Quest_Ship_7" which is in the bay near the beach.

Except that it doesn't seem to work for Cozumel. This is the code which is supposed to send you to a location at sea:
Code:
QuestToSeaLogin_PrepareLoc("KhaelRoa", "Quest_Ships", "Quest_Ship_5", true);
QuestToSeaLogin_Launch();
But when I try to run that, I end up near the shore, probably at co-ordinates 0,0. Similar code to send you to various sea locations seems to work for other islands. But for some reason, it doesn't work at Cozumel. In fact, that code is copied straight from the storyline code from "Tales of a Sea Hawk", it ought to send you somewhere near the Black Pearl for the final battle - "Quest_Ship_5" is actually further out from the island than "Quest_Ship_2", which is where the Black Pearl starts. Yet you always start the final battle in the bay by the island, the same place as I always go when I try to teleport to a locator at sea near Cozumel.

The best I've been able to do is to send you to Sand Bluff, a beach on Cayman. That gives you the opportunity to go to your cabin and put the free equipment into the weapons locker so that your boarders can use it. You could possibly add some more characters to "SideQuest.c" to use as officers - some well-equipped, well-skilled officers can also help you when boarding an enemy ship. Starting on the beach at Cayman would then allow you to equip the officers as well. And it's a lot quicker to sail from Cayman to Cozumel than from Speightstown!
 

Attachments

  • console.c
    36 KB · Views: 68
  • quests_side.c
    757.5 KB · Views: 70
Sorry, I goofed - I missed out a "-1" which gives the ship its default cannons. The correct lines should be, for yourself:
Code:
GiveShip2Character(PChar, "SP_Trinity", "Alpha", -1, SPAIN, true, true);
For a friend:
Code:
GiveShip2Character(CharacterFromID("Friend3"), "PO_Poseidon", "Delta", -1, SPAIN, true, true);
And for an enemy:
Code:
GiveShip2Character(CharacterFromID("Enemy1"), "FR_Superbe", "Primus", -1, FRANCE, true, true);
Changed the 'CharacterFromID' part to give a ship to another character. The nation in these lines doesn't affect the ship's flag, it affects the national modifiers for ship stats which you can find at the top of "Ships_init.c".

Now, as to locators. You can view locators using a program called TOOL:
http://piratesahoy.bowengames.com/Cloud/Tools/Modeling+Texturing/Inez Dias Tool.rar
There are locators in group "Quest_Ships" named "Quest_Ship_1", "Quest_Ship_2", etc., up to "Quest_Ship_8". Any of these should put you close to the enemy group which you're placing at "Quest_Ship_4", except for "Quest_Ship_7" which is in the bay near the beach.

Except that it doesn't seem to work for Cozumel. This is the code which is supposed to send you to a location at sea:
Code:
QuestToSeaLogin_PrepareLoc("KhaelRoa", "Quest_Ships", "Quest_Ship_5", true);
QuestToSeaLogin_Launch();
But when I try to run that, I end up near the shore, probably at co-ordinates 0,0. Similar code to send you to various sea locations seems to work for other islands. But for some reason, it doesn't work at Cozumel. In fact, that code is copied straight from the storyline code from "Tales of a Sea Hawk", it ought to send you somewhere near the Black Pearl for the final battle - "Quest_Ship_5" is actually further out from the island than "Quest_Ship_2", which is where the Black Pearl starts. Yet you always start the final battle in the bay by the island, the same place as I always go when I try to teleport to a locator at sea near Cozumel.

The best I've been able to do is to send you to Sand Bluff, a beach on Cayman. That gives you the opportunity to go to your cabin and put the free equipment into the weapons locker so that your boarders can use it. You could possibly add some more characters to "SideQuest.c" to use as officers - some well-equipped, well-skilled officers can also help you when boarding an enemy ship. Starting on the beach at Cayman would then allow you to equip the officers as well. And it's a lot quicker to sail from Cayman to Cozumel than from Speightstown!

Will check this out, thanks.

Btw, I've just got the latest NH version. Is there any way to get the old Flying Dutchman model back?
 
No, the replacement "CursedDutchman" model is in the installer, not the update. Why would you want the old one anyway? The new one looks much closer to the ship as seen in the films, both in colour and in shape.
 
No, the replacement "CursedDutchman" model is in the installer, not the update. Why would you want the old one anyway? The new one looks much closer to the ship as seen in the films, both in colour and in shape.

I dunno, personal preference I guess? So is it possible? Perhaps a download link to the original model files? Or shall I have to install the entire mod from scratch on a different folder?
 
Except that it doesn't seem to work for Cozumel. This is the code which is supposed to send you to a location at sea:
Code:
QuestToSeaLogin_PrepareLoc("KhaelRoa", "Quest_Ships", "Quest_Ship_5", true);
QuestToSeaLogin_Launch();
But when I try to run that, I end up near the shore, probably at co-ordinates 0,0. Similar code to send you to various sea locations seems to work for other islands. But for some reason, it doesn't work at Cozumel. In fact, that code is copied straight from the storyline code from "Tales of a Sea Hawk", it ought to send you somewhere near the Black Pearl for the final battle - "Quest_Ship_5" is actually further out from the island than "Quest_Ship_2", which is where the Black Pearl starts. Yet you always start the final battle in the bay by the island, the same place as I always go when I try to teleport to a locator at sea near Cozumel.
This does seem strange. In the stock game, you get teleported outside the bay for the final fight In fact, I never realised that it was actually very difficult to manually sail to this bay because I never needed to do that in the original game. But surely the model and locators are the same as in the old game?
 
Incidentally, I've tried out your changes and thanks to them it seems much more efficient now! So far the only little thing that I thought could be added was a way to disable the Worldmap encounters, so that no storms or enemy ships bother you during the short trip to Cozumel.

I added some extra weapons and armor to the other captains, and automatically assigned my rank to reach theirs (22) in quests_side.c. All fighting perks are researched for all captains to give them an edge over the random boarders. I added 3 friendly officers as passengers in case one wanted to capture an enemy ship and he lost some of his allies in the fight. Also, I added 6 more Enemies which are assigned luggers, but they're canceled out in the code by default.

The "Battlesim" appears as "case 11" in console.c. I also edited WhrWeather.c and added case "shipfight" which produces a gale.

Some shots after testing:

battlesim3.jpg

battlesim5.jpg

battlesim6.jpg
 

Attachments

  • SideQuest.c
    232.2 KB · Views: 80
  • console.c
    37.3 KB · Views: 67
  • WhrWeather.c
    19.8 KB · Views: 70
  • quests_side.c
    758.5 KB · Views: 68

I've revisited this simulator and tried to simplify things by putting everything in console.c so that I had an easier time preparing the ships & stats of the characters involved.

However, there's a problem - "Friend" and "Friend2" no longer appear in their ships. In addition, "Friend3" is the only one that appears, and he's seemingly assigned a random ship.

I do this by trial and error, so stuff like this is to be expected. Do you have solutions in mind?
 

Attachments

  • console.c
    46 KB · Views: 63
Under condition that you won't demand this mod goes into any future update:

"Friend", "Friend2" and "Friend3" are to be used as companions. You don't need 'AddPassenger' lines for them. Their 'SetCompanionIndex' lines all put them in slot 1, so each one overrides the previous one, leaving only "Friend3" in your fleet in slot 1. Try:
Code:
SetCompanionIndex(PChar, 1, GetCharacterIndex("Friend"));
SetCompanionIndex(PChar, 2, GetCharacterIndex("Friend2"));
SetCompanionIndex(PChar, 3, GetCharacterIndex("Friend3"));

Or you could use -1 instead of 1, 2 and 3, so that they'll each use any free slot available and won't replace any other companion ships you may have in your fleet.

You've commented out this line:
Code:
//GiveShip2Character(CharacterFromID("Friend3"), "PO_Poseidon", "Delta", -1, SPAIN, true, true);
That's why "Friend3" does not get the ship you want.
 
Under condition that you won't demand this mod goes into any future update:
Why not? Isn't it just a testing simulator? It could be useful for for any modder.
 
Under condition that you won't demand this mod goes into any future update:

Thanks for your advice, I'll certainly look into this.

However, I'd like to make things clear - when have I ever demanded anything to be included in a future update? Also, should we expect help from this forum under certain conditions only?
 
However, I'd like to make things clear - when have I ever demanded anything to be included in a future update? Also, should we expect help from this forum under certain conditions only?
Your recent poll regarding your Freeplay experiments - "Do you like this idea implemented to the mod?" - gives the distinct impression that's something you're angling for. And yes, it is entirely reasonable to expect limitations on the type and level of assistance available, not only from a technical standpoint but from a creative standpoint as well and the degree of time/effort involved.
 
But this thing is just an add to the console, where you can use it for tests. I have one such test thing already in the console. "case 6". It does no changes/harm to the game.
 
Your recent poll regarding your Freeplay experiments - "Do you like this idea implemented to the mod?" - gives the distinct impression that's something you're angling for. And yes, it is entirely reasonable to expect limitations on the type and level of assistance available, not only from a technical standpoint but from a creative standpoint as well and the degree of time/effort involved.
Angling for something isn't the same as "demanding" for it. I'm asking you guys for your thoughts, your opinions - not ordering you to do accept it. :rolleyes:
 
Angling for something isn't the same as "demanding" for it. I'm asking you guys for your thoughts, your opinions - not ordering you to do accept it. :rolleyes:
Perhaps there was no intent to pressure me into adding the FreePlay experiment into the mod, but that's how it seemed to me.

But this thing is just an add to the console, where you can use it for tests. I have one such test thing already in the console. "case 6". It does no changes/harm to the game.
Indeed it is relatively harmless, whereas the battle simulator adds a whole load of new character definitions. There is a maximum total number of characters which has already been increased several times, and I've no idea what that's done to overall game performance and stability.

Also, "console.c" is rather cluttered with various switch cases which might conceivably be of some use to some modder in the future, to the extent that they're now almost useless. If I want to run a test in "console.c", I don't search through the various cases on the off chance that there's something useful; I simply add what I need immediately below the 'int limit;' line, then remove it when I've finished. If I'd left in all the stuff I wrote which might conceivably be of some use to some modder in the future, "console.c" would be at least twice as big as it is now, and I'm probably not the only one!

Perhaps, instead of adding another case which may be of some use at some time, might it be time to clear away some of what is already there?

(Any future modder wanting to write a sea battle scene probably wouldn't use the battle simulator anyway. More important would be to check that it triggers at the appropriate point in the quest, at the appropriate location, with the appropriate characters. It would probably be as easy to write the whole thing from scratch as to edit the battle simulator with all those changes.)
 
Back
Top