• 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

How would you like being chased around the worldmap by some pirates when you are sailing the Dutchman?
Because THEY don't know you're submerged. Unless.... Perhaps @Levis can think of a way to disable chasing worldmap ships when you are submerged?

I think I can
 
You came pretty close, I think! Try instead to find this:
Code:
  if(Whr_IsNight())
   {
     visibility_range = visibility_range / 2;
     if(HasCharacterShipAttribute(chr, "night_stealth"))     visibility_range = visibility_range / 2;   // PB: Black Pearl stealth at night
   }
And add this below:
Code:
  if(CheckAttribute(chr, "ship.SubmergeDutchman"))
   {
     visibility_range = visibility_range / 999;
   }
 
wow I was really close^^ Your code works Pieter, but I had to had maaaany 9's to get a good result.. and it doesnt work with forts
 
Forts are special. They don't use the range to other ships at all. Which is messing us up on flag recognition also.
 
Yeah I know, I already saw your experiments in the code :D

Code:
      if(CheckAttribute(chr, "ship.SubmergeDutchman"))
       {
             visibility_range = 0;        // Making FD invisible when submerged
     }

I think that is just easier, setting visibility to zero^^ It works, but still not for forts and it doesnt work if the ships already saw you (when emerged). So this makes only the effect we want to when we put up the worldmap ship-encounters for the FD again. ;)
 
If that doesn't cause any weirdness (eg. divide by 0 or so), then that sounds like the way to go! :cheers
 
about the worldmap encounters
there are different kind of encounters in worldmap_encgen.c in the function wdmShipEncounter
they should all happen except WDM_ETYPE_FOLLOW. The function has something like this at the start
Code:
if(CheckAttribute(mc,"ship.SubmergeDutchman"))  return;
This should be removed and round the follow type a if statement should be made to check if you are submerged.

I only have my old version of the world map encounters here atm (not at my own computer) so cant give the precise code. but I think with this info you should be able to make it work.
 
aahh there's something wrong.. enemy ships wont recognize the FD at all, even when I emerge it. Only when e.g. I boarded a ship and go back to sea, the other ships are recognizing me.. so I guess we have to tell the game that when the FD emerges, the visibility changes back to normal

Code:
      if(CheckAttribute(chr, "ship.SubmergeDutchman"))
       {
             visibility_range = 0;        // Making FD invisible when submerged
     }
     else
     {
        visibility_range = 1000.0
     }

Does this seem logical to you?^^ or should I do another if-code?

(I changed my overall visibility range to 1000)
 
what you should do is this:
Code:
if(CheckAttribute(chr, "ship.SubmergeDutchman"))
{
visibility_range = 0; // Making FD invisible when submerged
ship.OldVis = visibility_range;
}
else
{
CheckAttribute(ship,"OldVis")
{
visibility_range = ship.OldVis;
}
else
{
visibility_range = 1000.0;
}
}
check also if there is a default visibility_range set somewhere already (how its set normally) and if thats the case change the 1000.0 to that.
 
yeah I changed the default visibility range to 1000, so I guess I can leave out the last else?
 
then take the variable which stores the default visibility if there is, else I sugest making one (by using the define statement).
you could check if there is a visibility stored for the ship already somewhere. that would make some sense but I dont know excatly from the top of my head how the system works.
else your if statement should work already but it there are visbility changes somwhere that could mess it up, thats why its better to save the old one and restore if when needed.
 
@Levis your code resutls in a runtime error

"
COMPILE ERROR - file: Screwface_functions.c; line: 42
Undeclared identifier: ship"
 
better make it chr.ship :p sorry was sleeping I guess
 
Code:
    if(CheckAttribute(chr, "ship.SubmergeDutchman"))
    {
    visibility_range = 0; // Making FD invisible when submerged
    chr.ship.OldVis = visibility_range;
    }
    else
    {
    CheckAttribute(ship,"OldVis")
    {
    visibility_range = chr.ship.OldVis;
    }
    else
    {
    visibility_range = 1000.0;
    }
    }

Like this? It still gives me a compile error:


COMPILE ERROR - file: Screwface_functions.c; line: 46
Invalid Expression
COMPILE ERROR - file: Screwface_functions.c; line: 46
invalid syntax
 
Which one is line 46?

In any case, I think this:
Code:
CheckAttribute(ship,"OldVis")
Should be this:
Code:
CheckAttribute(chr,"ship.OldVis")
 
okay. that solved the problem.

But the code doesnt work. Enemy ships can see me now no matter if I'm submerged or not. So I guess Levis' function somehow jumps always in the last part, where the visibility is restored back to default
 
Back
Top