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

Fixed Dutchman Submerged function

ugh I tought I fixed this but some really weird things are happening in the code it seems .... I was boarded now while being submerged XD.
 
This should do it :D.
@Pillat could you help test this?
Especially see if you can still be boarded while submerged, I think this is fixed now to but I dont know for sure.
For 3.4 I will see if I can make sure you can't fire you cannons while submerged also, but maybe @Pieter Boelen knows where this is managed and can add a quick fix?
 

Attachments

  • DUTCHMAN_FIX.zip
    71.6 KB · Views: 148
What is the difference between Ship_GetDistance2D and GetDistance2D? I see you replaced some of those calls.

Also, would this not do the opposite of what you want?
Code:
float GetVisibilityRange(int iRange)
{
   //Levis trying to get the dutchman out of reach when submerged
   ref PChar = GetMainCharacter();
   if(CheckAttribute(PChar, "ship.SubmergeDutchman"))
  {
     return DIST_NOSHIP;
   }
   //End edit
This will make the visibility range LARGER when you are submerged, instead of smaller. :confused:

As for the cannon reload, I am not too fussed about that. If the player wants to waste his cannons firing underwater, they can do so for all I care.
Your cannons are automatically reloaded when you emerge anyway, so you can't fire straight after emerging due to wet powder.

If you do want to try, I think the relevant file would be PROGRAM\SEA_AI\AICannon.c .
I suspect the Cannon_GetRechargeTime function would be most relevant.
 
The thing at the visibilty should be removed. The ship_distance takes the dutchman into account
 
How far do we need to go with working on this?

The submerged Dutchman is a tiny mod feature that is never going to work quite right anyway.
After all, the sea doesn't render properly below the surface anyway.

What would you need to consider this "good enough" for now?
 
Good enough is if you wont get attacked and boarded. The not shooting is extra.
 
Change the function in sea.c back to its original. that shouldn't make a difference.
 

Attachments

  • DUTCHMAN_FIX_1_1.zip
    71.5 KB · Views: 137
Thanks a lot! :cheers

So with this latest version, you don't have all those error.log entries anymore, right?
 
I had them because I changed something else also which wasn't included in here :p. Tried that to test but forgot to reverse it.
Dont have any error logs now.
 
Somehow, somewhere I managed to trigger these errors here:
Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2330
function 'Ship_GetDistance2D' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2330
function 'Ship_GetDistance2D' stack error
This was either in a storm or while being fired upon by a fort.
Probably the storm, looking at this code:
Code:
float fTornadoDistance = Ship_GetDistance2D(stf(Tornado.x), stf(Tornado.z), stf(arCharShip.Pos.x), stf(arCharShip.Pos.z));
Because Ship_GetDistance2D takes two characters as input, but that is four coordinates instead. That'd throw things off, no? :shock
 
This one would go wrong too:
Code:
float Ship_GetBortFireDelta()
{
   aref aCharacter = GetEventData();
   float x = GetEventData();
   float y = GetEventData();
   float z = GetEventData();
   float fDistance = Ship_GetDistance2D(x, z, stf(aCharacter.Ship.Pos.x), stf(aCharacter.Ship.Pos.z));
And this:
Code:
float fDist = Ship_GetDistance2D(x, z, sx, sz);
So I'm changing those calls back to GetDistance2D.
 
Yup, tough i fixed them, must have missed those
 
Just tested fix1_1 : Works almost like it should ;) They don't fire at all or manouver like they could see me, only if I'm getting too close, they are dodging, but that is necessary I guess. When I emerge, they immediatly open fire and/or trying to escape, so that works wonderful, too ;) only thing which is still there: the FD can fire when submerged. If you do that, enemy ships recognize you and will open fire. But I guess that should be quite easy to fix, I think we can just tell the game that cannons can't be loaded when submerged?
 
only thing which is still there: the FD can fire when submerged. If you do that, enemy ships recognize you and will open fire. But I guess that should be quite easy to fix, I think we can just tell the game that cannons can't be loaded when submerged?
Add the two lines to PROGRAM\SEA_AI\AIShip.c marked with PB below:
Code:
// LDH -->
// This is the original Ship_DoFire()
void Ship_DoAimedFire()
{
// KK -->
   ref PChar = GetMainCharacter();
   if(CheckAttribute(PChar, "ship.SubmergeDutchman")) return; // PB: Cannot fire while submerged
   PChar.Ship.Cannons.DoFireRequest = true;
// <-- KK

   int bCameraOutside = SeaCameras_isCameraOutside();

   SendMessage(&AISea, "lal", AI_MESSAGE_CANNON_FIRE, PChar, bCameraOutside);

   PostEvent("DoneFireRequest", 250.0); // KK
}

void Ship_DoFire()
{
// KK -->
   ref PChar = GetMainCharacter();
   if(CheckAttribute(PChar, "ship.SubmergeDutchman")) return; // PB: Cannot fire while submerged
   PChar.Ship.Cannons.DoFireRequest = true;
// <-- KK

   int bCameraOutside = SeaCameras_isCameraOutside();

   bCameraOutside = true;

   SendMessage(&AISea, "lal", AI_MESSAGE_CANNON_FIRE, PChar, bCameraOutside);

   PostEvent("DoneFireRequest", 250.0); // KK
}
// LDH <--
That basically prevents the "fire cannons" button from working while submerged. That should work, right?
 
Back
Top