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

Officer Flushing

Aubinator

Landlubber
Have you included a system that renews the officers in each port?

In the release version, when you hire all of the officers from a town, thats it.. no more officers from there EVER again... this is especially annoying when taking over colonies that are retaken and you tek them and retaken.. etc etc (horrible grammar/english.. sorry)... but eventually, you have no more officers to become governor,,,

I haven't seen any posts about this kind of system so... here's my 2 cents... add it! <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Basically have it replenish the crew JUST like in POTC... that was a good system.

Anywho, FIRST POST! w007!

Happy Sailin'!
 
<!--quoteo(post=165998:date=Oct 7 2006, 10:01 AM:name=Aubinator)--><div class='quotetop'>QUOTE(Aubinator @ Oct 7 2006, 10:01 AM) [snapback]165998[/snapback]</div><div class='quotemain'><!--quotec-->
Have you included a system that renews the officers in each port?

In the release version, when you hire all of the officers from a town, thats it.. no more officers from there EVER again... this is especially annoying when taking over colonies that are retaken and you tek them and retaken.. etc etc (horrible grammar/english.. sorry)... but eventually, you have no more officers to become governor,,,

I haven't seen any posts about this kind of system so... here's my 2 cents... add it! <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Basically have it replenish the crew JUST like in POTC... that was a good system.

Anywho, FIRST POST! w007!

Happy Sailin'!
<!--QuoteEnd--></div><!--QuoteEEnd-->

Maybe Cyberops can help with this. I didn't know officers don't respawn. Sounds like something else that needs fixing...
 
<!--quoteo(post=165998:date=Oct 6 2006, 08:01 PM:name=Aubinator)--><div class='quotetop'>QUOTE(Aubinator @ Oct 6 2006, 08:01 PM) [snapback]165998[/snapback]</div><div class='quotemain'><!--quotec-->
Have you included a system that renews the officers in each port?

In the release version, when you hire all of the officers from a town, thats it.. no more officers from there EVER again... this is especially annoying when taking over colonies that are retaken and you tek them and retaken.. etc etc (horrible grammar/english.. sorry)... but eventually, you have no more officers to become governor,,,

I haven't seen any posts about this kind of system so... here's my 2 cents... add it! <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Basically have it replenish the crew JUST like in POTC... that was a good system.

Anywho, FIRST POST! w007!

Happy Sailin'!
<!--QuoteEnd--></div><!--QuoteEEnd-->

I think it has more to do with how much time has passed. There is a line in the officers.c that states recharge time as 7 days + 7 random more. I think reducing it to 1 speeds up how fast officers reappear.

This line:
string sQuest = "RechargeOfficers";

/*m_*/ int iTime = 7 + rand(7); // Changing this to 1 should make them recharge faster but i will test and let you know.

Update: Yes indeed.

int iTime = 1

Recharges officers in a single day. Buy them then wait a day and try again.
 
Update again. I don't know what changed but I can't restore the officers like I did before. I don't know if something changed with the update but I can't get the officers to refresh in the tavern now either.

Anyone have any ideas?
 
<!--quoteo(post=166684:date=Oct 10 2006, 07:51 AM:name=windwolf7)--><div class='quotetop'>QUOTE(windwolf7 @ Oct 10 2006, 07:51 AM) [snapback]166684[/snapback]</div><div class='quotemain'><!--quotec-->
Update again. I don't know what changed but I can't restore the officers like I did before. I don't know if something changed with the update but I can't get the officers to refresh in the tavern now either.

Anyone have any ideas?
<!--QuoteEnd--></div><!--QuoteEEnd-->

The problem is that the officers are static. Officers are never actually recreated or even killed - RechargeOfficers() simply re-rolls the character sheet! Each tavern is allocated 2-3 officers. Whenever you hire an officer, the game *references* the tavern officer instead of copying him. Therefore, if you've hired three from the one tavern, there will never be any more from there. Ever. Not until you fire one or one of them dies.

BTW, RechargeOfficers() has a memory leak. There is a max of 2000 NPCs in the game, and a max of 60 officers. rechargeOfficers() forgets to eliminate the NPC reference each time it recharges, and just makes a new one. I purged 519 'dead' officers from my savegame last night, resolving some crashing issues. :p
 
Why, Fred Bob be a rememberin' yer name, matey! <img src="style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":eek:" border="0" alt="ohmy.gif" /> Thar be a Stone-D dat purty much kicked out de first mods fer PotC dat be published on dis here site shortly after PotC be released! <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
<!--quoteo(post=166695:date=Oct 9 2006, 08:02 PM:name=Stone-D)--><div class='quotetop'>QUOTE(Stone-D @ Oct 9 2006, 08:02 PM) [snapback]166695[/snapback]</div><div class='quotemain'><!--quotec-->
[
BTW, RechargeOfficers() has a memory leak. There is a max of 2000 NPCs in the game, and a max of 60 officers. rechargeOfficers() forgets to eliminate the NPC reference each time it recharges, and just makes a new one. I purged 519 'dead' officers from my savegame last night, resolving some crashing issues. :p
<!--QuoteEnd--></div><!--QuoteEEnd-->
<img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> thats a lot O' dead officers, How can this be fixed, and how do you purge dead officers mate from saved game ? <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Seems K9 tried to fix it already..... or maybe they tried to fix something else.

RechargeOfficers() //modif by Kogotoro/*_*/

And the code is a real mess so going to study the original akellas version.

First i will need to try the original akella version, and check if the recharge is working or not.

Also will be nice if someone can help me testing the original akella version, without mods, directly from CD.
 
I'll be able to do it tommorrow load stock game, to late here right now, unless someone beats me to it <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<!--quoteo(post=166709:date=Oct 9 2006, 09:21 PM:name=skull)--><div class='quotetop'>QUOTE(skull @ Oct 9 2006, 09:21 PM) [snapback]166709[/snapback]</div><div class='quotemain'><!--quotec-->
I'll be able to do it tommorrow load stock game, to late here right now, unless someone beats me to it <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->

Testing right now, the main problem is when an officer dies its not getting reflushed, like if he still hired, making less officers available
 
I think i am about half way of fixing it, the main problem is with officers that died, most affected ofcourse are the fighters or dunno if you own 2 ships and the second is destroyed with the entire crew may happen the same effect.

The first solution to this is at quests.c :

DEFAULT CODE :

void CharacterDeadProcess()
{
aref charef = GetEventData();
ref chref = GetCharacter(sti(charef.index));

int charType = FindFellowtravellers(pchar,chref);
switch(charType)
{
case FELLOWTRAVEL_COMPANION:
RemoveCharacterCompanion(pchar,chref);
break;
case FELLOWTRAVEL_OFFICER:
RemoveOfficersIndex(pchar,sti(chref.index));
RemovePassenger(pchar,chref);
break;
case FELLOWTRAVEL_PASSENGER:
RemovePassenger(pchar,chref);
break;
case FELLOWTRAVEL_CAPTIVE:
RemovePassenger(pchar,chref);
break;
}
QuestsCheck();
}


FIXED CODE :


void CharacterDeadProcess()
{
aref charef = GetEventData();
ref chref = GetCharacter(sti(charef.index));

int charType = FindFellowtravellers(pchar,chref);
switch(charType)
{
case FELLOWTRAVEL_COMPANION:
RemoveCharacterCompanion(pchar,chref);
break;
case FELLOWTRAVEL_OFFICER:

RemovePassenger(pchar, chref);

string sColony = pchar.location;

int iColony = -1;
iColony = FindColony(sColony);
if(iColony == -1)
{
iColony = FindLocation(sColony);
if(iColony != -1)
{
sColony = Locations[iColony].fastreload;
ReturnOfficerToBase(chref, sColony);
}
}

break;
case FELLOWTRAVEL_PASSENGER:
RemovePassenger(pchar,chref);
break;
case FELLOWTRAVEL_CAPTIVE:
RemovePassenger(pchar,chref);
break;
}
QuestsCheck();
}


It fixes 50% of the problem, when your fighter dies now it does return to the tabern queue, the problem is that when you rehire someone else from the queue it just deletes him, at least now they are showing back at the queue.


This is the event when you dismiss a officer ( it works properly and took the code from there to release when he dies )

void AcceptReleaseOfficer()
{
RemovePassenger(pchar, xi_refCharacter);

string sColony = pchar.location;

int iColony = -1;
iColony = FindColony(sColony);
if(iColony == -1)
{
iColony = FindLocation(sColony);
if(iColony != -1)
{
sColony = Locations[iColony].fastreload;
ReturnOfficerToBase(xi_refCharacter, sColony);
}
}

FillCharactersScroll();
FillPassengerScroll();
ExitRemoveOfficerMenu();
SendMessage(&GameInterface,"lsl",MSG_INTERFACE_SCROLL_CHANGE,"CHARACTERS_SCROLL",-1);
SendMessage(&GameInterface,"lsl",MSG_INTERFACE_SCROLL_CHANGE,"PASSENGERSLIST",-1);

ReMappingSkills();
SetVariable();
}

And this is the most important function, ITS REALLY WEIRD

void ReturnOfficerToBase(aref chr, string sColony)
{
EraseOfficerFromBase(chr.id);
/*string sId = chr.id;
chr.loyality = sti(chr.loyality) - 5;
officers[FindOfficerStek(sId)].character = sti(chr.index);
officers[FindOfficerStek(sId)].hired = "0";
officers[FindOfficerStek(sId)].nation = sti(chr.nation);
officers[FindOfficerStek(sId)].colony = sColony;*/
}

since /* */ disables code, the function just do a EraseOfficerFromBase(chr.id);
????? i am now really lost <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />

Traking it down finished at GenerateOfficer(int iStep, int iOfficerType)
Seems the function is not by default reseting the health of the player.
 
<!--quoteo(post=166695:date=Oct 9 2006, 11:02 PM:name=Stone-D)--><div class='quotetop'>QUOTE(Stone-D @ Oct 9 2006, 11:02 PM) [snapback]166695[/snapback]</div><div class='quotemain'><!--quotec-->
<!--quoteo(post=166684:date=Oct 10 2006, 07:51 AM:name=windwolf7)--><div class='quotetop'>QUOTE(windwolf7 @ Oct 10 2006, 07:51 AM) [snapback]166684[/snapback]</div><div class='quotemain'><!--quotec-->
Update again. I don't know what changed but I can't restore the officers like I did before. I don't know if something changed with the update but I can't get the officers to refresh in the tavern now either.

Anyone have any ideas?
<!--QuoteEnd--></div><!--QuoteEEnd-->

The problem is that the officers are static. Officers are never actually recreated or even killed - RechargeOfficers() simply re-rolls the character sheet! Each tavern is allocated 2-3 officers. Whenever you hire an officer, the game *references* the tavern officer instead of copying him. Therefore, if you've hired three from the one tavern, there will never be any more from there. Ever. Not until you fire one or one of them dies.

BTW, RechargeOfficers() has a memory leak. There is a max of 2000 NPCs in the game, and a max of 60 officers. rechargeOfficers() forgets to eliminate the NPC reference each time it recharges, and just makes a new one. I purged 519 'dead' officers from my savegame last night, resolving some crashing issues. :p
<!--QuoteEnd--></div><!--QuoteEEnd-->

Is there a place that the game says the max officers is 60. Can it be increased? or perhaps the code changed so that you hit the limit when you have hired 60, so that you can get them all from one country?

In the first lines of officer.c it says:

for(int i =0; i <MAX_COLONIES; i++)
{
iOfficersQuantity = 1 + rand(2);

If I changed to say 6 or 9 would the game still limit me to 60? 16 Colonies * 3 officers is only 48. I think i'll test after adding you fixes.

Also I tried winmerge to get rid the mokoko edits with the orginial code but I didn't have luck in recharging them so I went back. How did you test fo an improvment? Lack of memory leaks?

Also you mentioned that /* */ disables code. Are you sure? it seems then that alot of important code was disabled then. I know // does, but /* */?

Update: Setting quantity higher doesn't work. There are no officers then.
I also wonder about the /* */ code. Some changes don't seem to make sense. Why is recharge officers seemingly disabled and then referenced in 2 other places?
 
Well in fact the MAX quantity per tabern is 3 , thats why the function is iOfficersQuantity = 1 + rand(2);

that means 1 + 0 or 1+1 or 1+2 will be the cases, thats why you enter a tabern and you can see 1 ,2 or 3 officers to hire.

So the problem is basically when an officer dies, its not the case when you dismiss him since all is working fine returning the officer to the queue of tabern and you can rehire him ( the guy you rehire doesnt has the same attributes but uses the same pointer, this is the best way since the list wont over grow in the future )

I as wrote at the last post already made it to return an officer dead to the queue to rehire, but still have a bug that when you press HIRE it doesnt hires the player, it deletes to never came back.

Using the stock version without any patch, once some officer dies its never restocked.
 
Its done finally, now the Officers reload properly and they dont get lost in time.

Seems working good but needs extensive testing, please guys test it and tell me how it goes.

For testing use the supermod you have, 1.0 or 1.1 is ok.

File : Officers Fix.zip

Uploaded to : <a href="ftp://aop%40piratesahoy.org:piratesahoy@ftp.piratesahoy.org/Meximaster%20Files/" target="_blank">ftp://aop%40piratesahoy.org:piratesahoy@f...master%20Files/</a>

To Install : Extract zip contents keeping directory structure to your Age of pirates folder
 
<!--quoteo(post=166735:date=Oct 10 2006, 05:39 AM:name=Meximaster)--><div class='quotetop'>QUOTE(Meximaster @ Oct 10 2006, 05:39 AM) [snapback]166735[/snapback]</div><div class='quotemain'><!--quotec-->
Well in fact the MAX quantity per tabern is 3 , thats why the function is iOfficersQuantity = 1 + rand(2);

that means 1 + 0 or 1+1 or 1+2 will be the cases, thats why you enter a tabern and you can see 1 ,2 or 3 officers to hire.

So the problem is basically when an officer dies, its not the case when you dismiss him since all is working fine returning the officer to the queue of tabern and you can rehire him ( the guy you rehire doesnt has the same attributes but uses the same pointer, this is the best way since the list wont over grow in the future )

I as wrote at the last post already made it to return an officer dead to the queue to rehire, but still have a bug that when you press HIRE it doesnt hires the player, it deletes to never came back.

Using the stock version without any patch, once some officer dies its never restocked.
<!--QuoteEnd--></div><!--QuoteEEnd-->

Yes I found that out when I tested the change. Do you know where the max are set?

Also I found that the dismiss function doesn't work for me. I dismiss them and I still don't get new officers.
But That could be due to the fact I missed one of the itime entrys and it was still at 10+rand10. I changed and we will see.
 
Nice work guy's <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" /> I will try this fix when I get home <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Fred Bob : Aye, matey! That do be me - I'm back, but have other priorities, so not as much modding I reckon. Hey, maybe I might finish what I started with that surrender mod... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

Skull : Fairly easily, actually. I've uploaded my fixed scripts/officers.c file to the aop ftp (sd-OfficerFix-1.0.zip). This is the vanilla version that's been fixed - I don't have the supermod.

The routine kicks off each time RechargeOfficers() is called. To force it, add a call to that in the tavern dialog somewhere.

Windwolf7 : Check globals.c. Merely changing that value will crash the game, other sections need to be modified.

Anyway. Sorry for being so vague, I haven't got much time right now. I'm going to work on a more detailed Officers modification, which should allow for an unlimited number of officers.
 
<!--quoteo(post=166781:date=Oct 10 2006, 08:09 AM:name=Stone-D)--><div class='quotetop'>QUOTE(Stone-D @ Oct 10 2006, 08:09 AM) [snapback]166781[/snapback]</div><div class='quotemain'><!--quotec-->
Fred Bob : Aye, matey! That do be me - I'm back, but have other priorities, so not as much modding I reckon. Hey, maybe I might finish what I started with that surrender mod... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

I'm going to work on a more detailed Officers modification, which should allow for an unlimited number of officers.
<!--QuoteEnd--></div><!--QuoteEEnd-->

Sweet! unlimited officers would be awsome <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
<!--quoteo(post=166781:date=Oct 10 2006, 10:09 AM:name=Stone-D)--><div class='quotetop'>QUOTE(Stone-D @ Oct 10 2006, 10:09 AM) [snapback]166781[/snapback]</div><div class='quotemain'><!--quotec-->
Fred Bob : Aye, matey! That do be me - I'm back, but have other priorities, so not as much modding I reckon. Hey, maybe I might finish what I started with that surrender mod... <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
<snip>
<!--QuoteEnd--></div><!--QuoteEEnd-->Still got yer Stone-D.zip file from yer early PotC Surrender Mod work kickin' around some whars! <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> Jus' holler if'n ye be needin' a copy o' it agin, matey! <img src="style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
<!--quoteo(post=166750:date=Oct 10 2006, 08:05 AM:name=Meximaster)--><div class='quotetop'>QUOTE(Meximaster @ Oct 10 2006, 08:05 AM) [snapback]166750[/snapback]</div><div class='quotemain'><!--quotec-->
Its done finally, now the Officers reload properly and they dont get lost in time.

Seems working good but needs extensive testing, please guys test it and tell me how it goes.

For testing use the supermod you have, 1.0 or 1.1 is ok.

File : Officers Fix.zip

Uploaded to : <a href="ftp://aop%40piratesahoy.org:piratesahoy@ftp.piratesahoy.org/Meximaster%20Files/" target="_blank">ftp://aop%40piratesahoy.org:piratesahoy@f...master%20Files/</a>

To Install : Extract zip contents keeping directory structure to your Age of pirates folder
<!--QuoteEnd--></div><!--QuoteEEnd-->

Wow that is alot of files. I mean it's not really, but for this issue. You fond refs in all these files. This code is all over the place. Thanks for the hard work. I see you didn't annotate where you made changes. I'll see if I can't note them with winmerge when I copy them in.

Thanks Again.
 
Back
Top