• 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 Fixing the Different Flags Mod

Screwface, you are giving hope for this wonderful mod <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
<img src="http://www.theraider.net/films/raiders/gallery/dvdscreenshots/380.jpg" border="0" class="linked-image" />
<i>"It's beautiful!!!", Renee Bellow just before being vaporized by "The Wrath of God"</i>

Start Assassin storyline, went to 3D sailing mode, went back into port, game DIDN'T crash!
Sailed to Alice Town, went into port, again game didn't crash! <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
 
Did some more testing - Started at Eleuthera (M&C storyline):
- Port > Sea > Port: No CTD
- Sailed to Port Royale > Port > Sea > Port: NO CTD

Looking much better now. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
I still had the Hornblower crash and thought maybe it was caused by the following line:
<i>setCharacterShipLocation(characterFromID("Sir Peter Parker"), "Antigua_port");</i>
Reason being, maybe that messed up the number of ships in port?
However, it turned out that was not the case and the problem lied with the "BritishWarship" code instead.
The code said:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;
    refShip.Flags.NoPennants = true;<!--c2--></div><!--ec2-->
But should've been:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast0.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;
    refShip.Flags.NoPennants = true;<!--c2--></div><!--ec2-->
Note the missing <i>Mast0</i> part for the flag added into the hull itself.

I'm thinking that this same problem might be the reason for the seemingly random crashes that are still left with this mod.
After all, the ships selected in 3D sailing mode are random, so the loading of a ship with incorrect flag-code and subsequent crash would also be random.
This indicates that it is VERY important to make sure the code IS correct for the ship, otherwise <img src="style_emoticons/<#EMO_DIR#>/boom.gif" style="vertical-align:middle" emoid=":boom" border="0" alt="boom.gif" />

If so, it'd be a good idea for someone to go over the ships_init.c file and check it with all ships to make sure it's correct.
Using GM Viewer with "Show Labels" and "Show Locators" on, this isn't so hard. Make sure you also check the hulls!
 
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><i><b>Alpha 9.5 Patch 2 Update WIP File</b></i><!--sizec--></span><!--/sizec-->

Please have a look at this file:
<a href="http://www.piratesahoy.net/build/temp/pb_upd_flags_js.exe" target="_blank">http://www.piratesahoy.net/build/temp/pb_upd_flags_js.exe</a> (10 MB)

It contains:
- Pirate_KK's Different Flags mod, fixed by Screwface
- Thomas the Terror's latest flags
- Various code by Captain Maggee for standard storyline quest fixes and updates
- Various code by Captain Maggee for Jack Sparrow quest fixes and updates
- Various additional code for new mods, such as new weapons by Thomas the Terror and some new character models
- Various fixes

It comes recommended to install this with WinMerge to see what's new.
Note that some of the required resources are NOT included. Didn't have <i>that</i> much time. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
<!--quoteo(post=331584:date=Jun 22 2009, 05:40 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 22 2009, 05:40 AM) <a href="index.php?act=findpost&pid=331584"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec--><!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><i><b>Alpha 9.5 Patch 2 Update WIP File</b></i><!--sizec--></span><!--/sizec--><!--QuoteEnd--></div><!--QuoteEEnd-->
Hey Pieter, just letting you know JS will crash on going to sea with those current files. Find attached file that appears to fix it <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />

[attachment=3198:LegendJackSparrow.c]

Note: PROGRAM/Storyline

I noticed all of the other files like this had two lines and tried it with JS and it made the crash disappear <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
Oops... mistake. Thanks for catching. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
<!--quoteo(post=331575:date=Jun 21 2009, 09:09 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 09:09 PM) <a href="index.php?act=findpost&pid=331575"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I still had the Hornblower crash and thought maybe it was caused by the following line:
<i>setCharacterShipLocation(characterFromID("Sir Peter Parker"), "Antigua_port");</i>
Reason being, maybe that messed up the number of ships in port?
However, it turned out that was not the case and the problem lied with the "BritishWarship" code instead.
The code said:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;
    refShip.Flags.NoPennants = true;<!--c2--></div><!--ec2-->
But should've been:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast0.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;
    refShip.Flags.NoPennants = true;<!--c2--></div><!--ec2-->
Note the missing <i>Mast0</i> part for the flag added into the hull itself.

I'm thinking that this same problem might be the reason for the seemingly random crashes that are still left with this mod.
After all, the ships selected in 3D sailing mode are random, so the loading of a ship with incorrect flag-code and subsequent crash would also be random.
This indicates that it is VERY important to make sure the code IS correct for the ship, otherwise <img src="style_emoticons/<#EMO_DIR#>/boom.gif" style="vertical-align:middle" emoid=":boom" border="0" alt="boom.gif" />

If so, it'd be a good idea for someone to go over the ships_init.c file and check it with all ships to make sure it's correct.
Using GM Viewer with "Show Labels" and "Show Locators" on, this isn't so hard. Make sure you also check the hulls!<!--QuoteEnd--></div><!--QuoteEEnd-->
I didn't have time to continue the work yesterday evening but i'm thinking that you must be right about those random crashes !
For now, i didn't see what part of code can cause those crashes
I will have more time to install patch 2 update this afternoon <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
How many ships are in ships_init file ? <img src="style_emoticons/<#EMO_DIR#>/pirate-ayant-soif.gif" style="vertical-align:middle" emoid=":rumgone" border="0" alt="pirate-ayant-soif.gif" />

<img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
No problem, Screwface. I'll be busy until the end of this week anyway, so won't be able to do much myself in the first place.
But NEXT week is another story.... <img src="style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />

At the moment I have 212(!!!) ships in my PotC game installation, so that's approximately the number of ships in ships_init.c.
If you think that checking all these manually is a bit too much work, you can also sail around at random and whenever there is a crash,
I think compile.log will tell you the last ship it was putting flags on. So then you'd have to check that ship only.

Of course that does mean you might accidentally miss some mistakes, but I don't know how many mistakes there would be in the first place.
We can also use our testers for this purpose and have a bigger chance of catching them all. Or am I being too evil here...? <img src="style_emoticons/<#EMO_DIR#>/whippa.gif" style="vertical-align:middle" emoid=":whipa" border="0" alt="whippa.gif" />
 
I have encountered a random crash on sailing into Nevis.
Coastal traffic consitted of:
- A Brig flying British colors
- A Galeoth flying British colors
- A Cutter flying Pirate colors
- A Xebec flying Pirate colors
- A Barque flying British colors
- A Light Pinnace flying British colors
 
Which was the last one?
Cutter is fine. I have put pennants on those, and I can sail around with it, without crashing.
 
<!--quoteo(post=331761:date=Jun 22 2009, 09:31 PM:name=Thomas the Terror)--><div class='quotetop'>QUOTE (Thomas the Terror @ Jun 22 2009, 09:31 PM) <a href="index.php?act=findpost&pid=331761"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Which was the last one?
Cutter is fine. I have put pennants on those, and I can sail around with it, without crashing.<!--QuoteEnd--></div><!--QuoteEEnd-->
Not sure but in a seperate case the lineship stuffed up (not sure which model of lineship)
 
I suppose the bug can appear when we are sailing with ship ourselves, right?

So the easy way to check all ships one by one is to add this code in console :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    If(!Checkattribute(pchar,"cheatship")) Pchar.cheatship = 0;
    int con = sti(Pchar.cheatship);
    if(con<SHIP_TYPES_QUANTITY)
    {
        GiveShip2Character(pchar,ShipsTypes[con].id,"HMS Interceptor",ENGLAND,true,true);
        Pchar.cheatship = con +1;
    }
    logit("*************************** Ship : " + ShipsTypes[con].id + " , Index : " + con + " ");
    trace("*************************** Ship : " + ShipsTypes[con].id + " , Index : " + con + " ");<!--c2--></div><!--ec2-->

Each time you will hit f12 in port, you will be equip with the next ship in ships_init.c. Go to 3d sailing, if no problem, dock and redo with next ship..... <img src="style_emoticons/<#EMO_DIR#>/sailr.gif" style="vertical-align:middle" emoid=":sail" border="0" alt="sailr.gif" />
If CTD, the last one in the compile.log could be the problem...
For moment, i have tested the 20 first ships and no problems

If someone want to test from end to beginning, just replace the code above by :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    If(!Checkattribute(pchar,"cheatship")) Pchar.cheatship = SHIP_TYPES_QUANTITY-1;
    int con = sti(Pchar.cheatship);
    if(con>=0)
    {
        GiveShip2Character(pchar,ShipsTypes[con].id,"HMS Interceptor",ENGLAND,true,true);
        Pchar.cheatship = con -1;
    }
    logit("*************************** Ship : " + ShipsTypes[con].id + " , Index : " + con + " ");
    trace("*************************** Ship : " + ShipsTypes[con].id + " , Index : " + con + " ");<!--c2--></div><!--ec2-->
 
For the moment, i've checked the 57 first ships :

the Battleship3_44 (index 56) have no flags on her masts but no crash

I have no texture on the masts of the Brig3_44. The BL50.TGA.tx are missing in the textures\ships directory but perhaps that's just in my game <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
If a ship has no flags, and this is also in it's ships.init file, then everything is allright. If it HAS a flag, but no code for the flag, then it crashes (I think),
 
Battleship3_44 and the two reskins of it by Jesus of Bonaire should have the following code:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast2.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast3.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;
    refShip.Flags.Mast4.Flag2 = FLAG_ENSIGN;
    refShip.Flags.NoPennants = true;<!--c2--></div><!--ec2-->
Brig3_44 missing texture confirmed; HEX-edited to deck.tga instead.
 
XebecSchooner proved rather harder to fix.
I had to remove the flags from the reys altogether, though possibly that isn't quite required. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
I always did consider that ship over-flagged though. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />
 
Originally the SchoonerXebec looked like this:
<img src="http://www.piratesahoy.net/build/site/images/all_ships/schoonerxebec.jpg" border="0" class="linked-image" />

I didn't manage to get that to work properly in my game and thought there were too many flags anyway,
so I modified the model to remove the rey-flags and keep the mast-top ones. Added the pennants too.
Here's the end result:

<img src="http://www.piratesahoy.net/build/temp/SchoonerXebec.jpg" border="0" class="linked-image" />

Find attached the corrected model file folder. Here's the code required:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    refShip.Flags.Mast2.Flag1 = FLAG_PENNANT;
    refShip.Flags.Mast3.Flag1 = FLAG_PENNANT;
    refShip.Flags.Mast4.Flag1 = FLAG_ENSIGN;<!--c2--></div><!--ec2-->
WHY do I have to set up mast 4 as having the ensign, while mast 4 is the stern mast and it is mast 3 that gets the ensign??? <img src="style_emoticons/<#EMO_DIR#>/piratesing.gif" style="vertical-align:middle" emoid=":shock" border="0" alt="piratesing.gif" />

<b>Edit:</b> I sent Pirate_KK a PM to notify him of these recent developments. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
Back
Top