• 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

Did you see my previous message edit ?
The waitdelay is set in refreshflags but is deleted at the end of a waitdelay!

i will post a new update later tonight ! For now i have to go out for the national celebration in my country ! See you later <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
14 Julliet, fall of the Bastille and the start of the French Revolution.

Viva la France Screwface <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
<img src="style_emoticons/<#EMO_DIR#>/bow.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="bow.gif" />
Thomas you have more knowledge about the 14 juillet than many of my fellow countrymen <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

Here the last adjustments :
- The errors message about the waidelay attribute should be fixed !
- When the update flags is delayed, only ships who needs to be updated are done at the Ai sea update, not the others.

This update is made for last version of experimental mod + yesterday update <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 

Attachments

  • Period_Flags_mod_update_07_15_09.rar
    103.9 KB · Views: 123
This is brilliant, Screwface! I think you're running out of things to fix here. I sure do hope so. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
When playing around a bit in Master and Commander, as soon as I was out of range of the fort,
I raised British colours. However, the flag on my ship did not update.
MY ship was undamaged, but another ship had lost a mast and surrendered before that.
Is there still some code to prevent flag updates in such a case?
 
When playing around a bit in Master and Commander, as soon as I was out of range of the fort,
I raised British colours. However, the flag on my ship did not update.
MY ship was undamaged, but another ship had lost a mast and surrendered before that.
Is there still some code to prevent flag updates in such a case?
I did the same but flag on my ship updated !
I have a clue where your "bug" could come ! Actually, when a mast is lost around, you have a delay of 1000 frames but the problem is if another mast fall during the waitdelay, this one will be increased of 1000 frames so if there are 3 masts which fall, the refresh flag will be delayed of 3000 frames ! You could have to wait a relatively long moment before having your flag refreshed. The logic would be that when there are multiple mast fall relatively close, you would have to wait only the remained frames of the previous fall + 1000 new frames when another mast is fallen. I'm not sure i'm very clear to explain but in fact, you would have to extend of 1000 frames the current waitdelay when it is not finished, to always have to wait only 1000 frames according to the last mast fall there was around. Here is the little fix to do that :

In Battleinterface.c replace
Code:
void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();

if(chrIdx<0) return;
Characters[chrIdx].fallen = 1; //screwface
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
if(!CheckAttribute(GetMainCharacter(),"Waitdelay"))
{
Characters[GetMainCharacterIndex()].waitdelay = 1000; //screwface : big value needed !!!!!
waitdelay();
}
else
{
// A waitdelay is still running so we increase its time
Characters[GetMainCharacterIndex()].waitdelay = sti(Characters[GetMainCharacterIndex()].waitdelay) + 1000;
}
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
//waitdelay();
}

by

Code:
void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();

if(chrIdx<0) return;
Characters[chrIdx].fallen = 1; //screwface
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
if(!CheckAttribute(GetMainCharacter(),"Waitdelay"))
{
Characters[GetMainCharacterIndex()].waitdelay = 1000; //screwface : big value needed !!!!!
waitdelay();
}
else
{
// A waitdelay is still running so we increase its time
if(CheckAttribute(&BattleInterface, "Waitrefreshflags"))
{
// executed frames number + 1000 new frames
Characters[GetMainCharacterIndex()].waitdelay = sti(BattleInterface.Waitrefreshflags) + 1000;
}
else
{
Characters[GetMainCharacterIndex()].waitdelay = sti(Characters[GetMainCharacterIndex()].waitdelay) + 1000;
}
}
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
//waitdelay();
}
I hope it will solve the problem !
 
Thanks, Screwface!
I actually ran into the problem at least twice and one time I waited a bit to see if the flag would update afterwards.
Maybe I didn't wait long enough though. I'll see if I get not-updating-flags again with this code added.
 
I have just observed that when there is a flag-update delay, the flags do update at the end of the delay.
So that seems good so far. :doff
 
Let's move this thread for everyone to see, considering it's included in Alpha 9.5 Patch 3.
 
Can somebody try to capture a town for himself in Alpha 9.5 Patch 3?
I'm interested to know if your personal flag replaces the nation flag properly after that.
ooking at the code, I'm not sure if it'd work right with the Different Flags mod... :?
 
I just set a fort to PERSONAL_NATION and the flag is a defined Personal flag. (tested for the Interceptor/Dauntless) :cheeky

One thing is that PERSONAL_NATION pennants, not sure if it was my problem or the pennants are still wrong and are ensigns :(
 
I made a slight update to how this mod works:

- Companion ships now use the same code to select between merchant and navy ensigns as the player does, eg.: Letter of Marque required
I had been a bit confused by what happened to me on this screenshot:
SteamFrigates.jpg

My player ship used a merchant ensign, but my companions had the naval one. That wasn't the idea. :facepalm

- Using an "HMS" or "USS" prefix for your ship name no longer "cheats" you a navy ensign. You HAVE to get a Letter of Marque.
This created a slight weird effect with the Master & Commander storyline though, as we removed your rank there for Free Play purposes.
But the HMS Surprise with a merchant ensign looks rather strange.

Turns out there was some unused code in place to take care of this though, so I just added this line to the HMS Surprise in Ships_init.c:
Code:
refShip.Flags.UseNavalFlag = true;
This works with "Flags.UseMerchantFlag" too.

Are there any other ships that we can think of that should have these lines added to them?
 
Good point, especially on the Endeavour: She must NOT use the Naval Flag!
So that'll be:
HMS_Interceptor - NAVAL
USS_Constitution - NAVAL
HMS_Endeavour - MERCHANT
HMS_Dauntless - NAVAL
WickedWench - MERCHANT
HMS_Victory - NAVAL
HMS_Surprise - NAVAL
PO_Trinity - NAVAL

Any other ship, it'll be up to the player. Unless someone comes up with any others that should be pre-set. :doff
 
Just wondering, can the player still override these pre-set flags in-game if they want to?
 
You can still choose your own personal and pirate flag and hoist whichever nation flag you want.
But you won't get a navy flag on the Wicked Wench even if you've got a Letter of Marque.
And you won't get a merchant flag on the HMS Victory even if you DON'T have a Letter of Marque.

But then, you couldn't "choose" between the two before anyway, unless you knew of the prior HMS/USS "cheat".
 
Good; I was only referring to the personal flags, since many people prefer to use those. :onya
 
Back
Top