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

What's up with the hoist flag option?

Mad-h

Landlubber
I was searching the forums, so i can find a solution to the hoist a pirate flag problem, but it seemed there were no solution, but many people talking about it not really works. It causes CTDs or just doing nothing. Well i don't know what's wrong with the code, but one, or two times it worked correctly, then it did nothing. And this hoist a flag option is a must have for a pirate. So what up with it? Any solutions?

(Anyways i edited the code, to a more simple one, i'm not a good coder but it works now for me, it only makes all the nations except pirate hostile when hoisting a flag, and setting back the relations to the original one when using the map. As far as i know it got the same effect as the old hoist flag code had. But i might be wrong.)
 
It hasn't been working since the release of Build 12, in which it was implemented (I think), but nobody really tried to fix it, I think, but there were much more serious bugs to be fixed. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />

I dunno, can anyone tell us what it was originally intended to do? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
I haven't got the slightest idea what's it supposed to do. I wasn't around before Build 12 was released. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

Could you please send me the changed code you made, Mad-h? I would like to add it in instead of the old code that doesn't work. Better to have simple code that works than complicated code that doesn't. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
<!--QuoteBegin-Pieter Boelen+Oct 3 2005, 10:43 AM--><div class='quotetop'>QUOTE(Pieter Boelen @ Oct 3 2005, 10:43 AM)</div><div class='quotemain'><!--QuoteEBegin-->I haven't got the slightest idea what's it supposed to do. I wasn't around before Build 12 was released. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

Could you please send me the changed code you made, Mad-h? I would like to add it in instead of the old code that doesn't work. Better to have simple code that works than complicated code that doesn't. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
<div align="right">[snapback]131711[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->

Well it supposed to make all nearby ships enemy, so you don't have to shoot at them if they are friendly or neutral, so you don't get any reputation loss because of this. You just show them that you are about to plunder them, and they will attack you. I found the description in the build 11 readme if i'm right.

the code is in the battle_interface\battleinterface.c, find this part:
switch(commandName)
{
// Hoist Flag MOD -Amokachi

int franciarel = (GetRMRelation(GetMainCharacter(),FRANCE);
int spanyolrel = (GetRMRelation(GetMainCharacter(),SPAIN);
int portugalrel = (GetRMRelation(GetMainCharacter(),PORTUGAL);
int hollandrel = (GetRMRelation(GetMainCharacter(),HOLLAND);
int angolrel = (GetRMRelation(GetMainCharacter(),ENGLAND);

case "BI_HoistFlag":

// become an evil pirate
mainChr.nation = PIRATE;
for(int cc = 1; cc < 4; cc++) {
if(GetRemovable(GetCharacter(GetCompanionIndex(mainChr, cc)))) {
Characters[GetCompanionIndex(mainChr, cc)].nation = mainChr.nation; } } // NK so comps' nations update

// hostile all nations, ally pirates
// RM -->


SetNationRelation2MainCharacter(PIRATE, RELATION_FRIEND);
SetNationRelation2MainCharacter(ENGLAND, RELATION_ENEMY);
SetNationRelation2MainCharacter(FRANCE, RELATION_ENEMY);
SetNationRelation2MainCharacter(SPAIN, RELATION_ENEMY);
SetNationRelation2MainCharacter(PORTUGAL, RELATION_ENEMY);
SetNationRelation2MainCharacter(HOLLAND, RELATION_ENEMY);
if(GetRMRelation(GetMainCharacter(), PIRATE) < REL_AMNESTY) SetRMRelation(GetMainCharacter(), PIRATE, REL_AMNESTY);




// become hostile to all groups in battle except pirates


// RM <--

UpdateRelations();
RefreshBattleInterface();
Log_SetStringToLog("You have hoisted a Pirate flag! Argh!");
break;
(yeah i used some hungarian words, sorry
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> )

And to set the relations back to the original find this part:

case "BI_Map":
SetRMRelation(GetMainCharacter(), FRANCE, franciarel);
SetRMRelation(GetMainCharacter(), SPAIN, spanyolrel);
SetRMRelation(GetMainCharacter(), PORTUGAL, portugalrel);
SetRMRelation(GetMainCharacter(), HOLLAND, hollandrel);
SetRMRelation(GetMainCharacter(), ENGLAND, angolrel);
UpdateRelations();
RefreshBattleInterface();

Sea_MapLoad();
break;

That's all, not so elegant programming, but it works. But look at the old code, and make sure that this one does the same as the old one.
 
I have added your code to the modpack. I hope it works. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
<!--quoteo(post=131436:date=Sep 29 2005, 01:47 AM:name=Mad-h)--><div class='quotetop'>QUOTE(Mad-h @ Sep 29 2005, 01:47 AM) [snapback]131436[/snapback]</div><div class='quotemain'><!--quotec-->I was searching the forums, so i can find a solution to the hoist a pirate flag problem, but it seemed there were no solution, but many people talking about it not really works. It causes CTDs or just doing nothing. Well i don't know what's wrong with the code, but one, or two times it worked correctly, then it did nothing. And this hoist a flag option is a must have for a pirate. So what up with it? Any solutions?<!--QuoteEnd--></div><!--QuoteEEnd-->

i don't know so much that the option is good for a pirate but i can see the uses for it as a privateer aswell.
in the age of sail days it was common for them and crack frigates to sail under the flag of their enemy nation. when a fat merhant from that side moved in near you to get a free convoy out of it you'd throw up you true colours and fall on them. this was used to tick navy ships aswell. i think the term was a rue de guerre and was quite legal so long as you had your true flag flying before you fired any shots. this could be handy so that you can get right up close and personal with those enemy ships before you go blowing the crap out of them. maybe an option so you can choose which flag you are going to raise. even enemy ones would be good
 
Sorry, I fear the latest fix for this won't do either. Where you put that section now
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void BI_LaunchCommand()
{
....
    // --> Hoist the flag code fix by Mad-h
    int franciarel = (GetRMRelation(GetMainCharacter(),FRANCE));
    int spanyolrel = (GetRMRelation(GetMainCharacter(),SPAIN));
    int portugalrel = (GetRMRelation(GetMainCharacter(),PORTUGAL));
    int hollandrel = (GetRMRelation(GetMainCharacter(),HOLLAND));
    int angolrel = (GetRMRelation(GetMainCharacter(),ENGLAND));

    switch(commandName)
    {
....<!--c2--></div><!--ec2-->
will it run every time you launch a command at sea (maybe only if you use the icon menu at the low margin of the screen, and maybe you don't encounter this bug if you go to the map only with F3 <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />h: )

So if you launch a command AFTER hoisting the pirateflag it stores your piraterelations and the old "before hoisting" relations get lost <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />

There seems to be another error, maybe older: The whole old flagraising code has been outcommented by /* ... */ But within that section there was a smaller section already outcommented:

/*SetNationRelation2MainCharacter(PIRATE, RELATION_FRIEND);
....
SetNationRelation2MainCharacter(HOLLAND, RELATION_ENEMY);*/

Putting a /* ... */ within a /* ... */ swallows one end of the comment and messes up the following code terribly ! (Took me HOURS to find that one <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> )



IDEA FOR A SOLUTION

Correct me if I am wrong: this mod shall work this way:

- I approach some ship under a "normal" flag

-Then I hoist the pirateflag. My nationality becomes Pirate, and all non-pirateships shall become hostile

-When I go back to the map my crime shall be forgotten, and the nationrelations that I had before hoisting the pirateflag shall be restored. Shall my old nationality be restored as well?

If that is what you want here is a proposal: instead of using integer variables (which cause problems if they are are called but not defined yet) attach attributes to the maincharacter in order to store the "before hoisting" relations. (And, if desired, the old playernation)

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    switch(commandName)
    {
    // Hoist Flag MOD -Amokachi
    case "BI_HoistFlag":

        .....
        // --> Hoist the flag code fix by Mad-h
        mainChr.franciarel = (GetRMRelation(GetMainCharacter(),FRANCE));    // ccc dec 05
        mainChr.spanyolrel = (GetRMRelation(GetMainCharacter(),SPAIN));    // ccc dec 05
        mainChr.portugalrel = (GetRMRelation(GetMainCharacter(),PORTUGAL));    // ccc dec 05
        mainChr.hollandrel = (GetRMRelation(GetMainCharacter(),HOLLAND));        // ccc dec 05
        mainChr.angolrel = (GetRMRelation(GetMainCharacter(),ENGLAND));    // ccc dec 05

        // store old playernation
        mainChr.oldnation = mainChr.nation;    // ccc dec 05

        // become an evil pirate
        mainChr.nation = PIRATE;
        ....<!--c2--></div><!--ec2-->
A little bit below the current code has several commands like this

SetNationRelation2MainCharacter(PIRATE, RELATION_FRIEND);

These do not work, cause the function SetNationRelation2MainCharacter has been replaced with SetRMRelation since the marriage mod. So the section that sets our relation with all non-pirates to hostile must read like this:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // hostile all nations, ally pirates
         SetRMRelation(GetMainCharacter(), ENGLAND, REL_WAR);
         SetRMRelation(GetMainCharacter(), FRANCE, REL_WAR);
         SetRMRelation(GetMainCharacter(), SPAIN, REL_WAR);
         SetRMRelation(GetMainCharacter(), PORTUGAL, REL_WAR);
         SetRMRelation(GetMainCharacter(), HOLLAND, REL_WAR);
        if(GetRMRelation(GetMainCharacter(), PIRATE) < REL_AMNESTY) SetRMRelation(GetMainCharacter(), PIRATE, REL_AMNESTY);<!--c2--></div><!--ec2-->
That makes us a Pirate hated by all nations. If desired I can add the "restore all relations by entering the map" part as well, the part that in it's current form causes the LOM bug <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> But I wont have time for PotC till Monday.
 
Thanks a lot for looking into this bug, CCC! I'll try and put that code in there to see if that does work.
Did the Hoist the Flag mod ever work? I never used it, so I don't know. For all I know, it never worked in Build 12. I don't really know what it's supposed to do either. Should it just set all non-pirate ships to enemy and, after leaving battlemode, reset the nation releations? Or shouldn't the nation relations be reset? I really don't know. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
BTW, if you enter the map by means of the Fast Command icon on TOP of the screen the code in LogInterface.c runs. So if you use that icon neither Mad-h's code nor the related LOM bug takes effect.
Therefore I moved the codesection that sets your relations back into sea.c (without the bug <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" /> ). Now entering the map by any way will hush up the fact that you raised a pirate flag.

But I found it a bit too easy that you could hide your piracy that easily. So I added a little twist to the enc_walker.c file: Some witness of your Jolly Roger-hoisting may later recognize and denounce you in towns.

There was some code by NK to change the nationality of your companions in accordance with yours. Couldn't test that yet, could someone who has a save with a fleet check if all your ships change to pirate and back with you?


BTW2: Enc_walker.c includes also another relationfix: If you get caught pickpocketing you'll be attacked. Should have been that way always, but someone overwrote that some time ago.
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> there, CCC,

Many thanks for the fix. I'll be testing it out ASAP.

Great work.

Cheers <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Back
Top