• 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 Capture Colonies: Governor Does Not Change

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
PROGRAM\Towns\Towntable.c:
Code:
    ref gov = &characters[govidx];
     gov.nation = iNation;
     if (iNation != PERSONAL_NATION)
     {
       // Create new governor:
       SetRandomNameToCharacter(gov);
       switch(iNation)
       {
         case ENGLAND:
           gov.greeting = "Gr_Robert Christopher Silehard";
         break;
         case FRANCE:
           gov.greeting = "Gr_joseph claude le moigne";
         break;
         case SPAIN:
           gov.greeting = "Gr_Christofor Manuel de Alencar";
         break;
         case PIRATE:
           gov.greeting = "Gr_Isenbrandt Jurcksen";
         break;
         case HOLLAND:
           gov.greeting = "Gr_Reynard Grueneveldt";
         break;
         case PORTUGAL:
           gov.greeting = "Gr_Jacinto Arcibaldo Barreto";
         break;
         case AMERICA:
           gov.greeting = "Gr_Robert Christopher Silehard";
         break;
       }
       SetModelFromID(gov, GetRandomModelForTypeExSubCheck(-1, "Rich_citizens", "man", iNation)); // PB: Give this guy a random model
     }
I think there is a logic error with the above code because it relies on all governors having a section of code like this in their character init entries:
Code:
// KK -->
   ch.nation.n0.name = "Michael";
   ch.nation.n0.lastname = "Johnson";
   ch.nation.n0.model = "huber_eng2_17";
   ch.nation.n0.sex = "man";
   ch.nation.n0.greeting = "Gr_Robert Christopher Silehard";
   ch.nation.n1.name = "Joseph";
   ch.nation.n1.lastname = "Fayette";
   ch.nation.n1.model = "huber_fra3_17";
   ch.nation.n1.sex = "man";
   ch.nation.n1.greeting = "Gr_joseph claude le moigne";
   ch.nation.n2.name = "Miguel";
   ch.nation.n2.lastname = "de Suza";
   ch.nation.n2.model = "huber_spa2_17";
   ch.nation.n2.sex = "man";
   ch.nation.n2.greeting = "Gr_Christofor Manuel de Alencar";
   ch.nation.n4.name = ch.old.name;
   ch.nation.n4.lastname = ch.old.lastname;
   ch.nation.n4.model = ch.model;
   ch.nation.n4.sex = ch.sex;
   ch.nation.n4.greeting = ch.greeting;
   ch.nation.n5.name = "Menirez";
   ch.nation.n5.lastname = "De Marco";
   ch.nation.n5.model = "huber_por_17";
   ch.nation.n5.sex = "man";
   ch.nation.n5.greeting = "Gr_Jacinto Arcibaldo Barreto";
// <-- KK
But not all of them do. And it is probably a LOT of hard work to set that up.

So how about this simplified version instead?
Code:
    ref gov = &characters[govidx];
     gov.nation = iNation;
     if (iNation != PERSONAL_NATION)
     {
       SetRandomNameToCharacter(gov);
       switch(iNation)
       {
         case ENGLAND:
           gov.greeting = "Gr_Robert Christopher Silehard";
         break;
         case FRANCE:
           gov.greeting = "Gr_joseph claude le moigne";
         break;
         case SPAIN:
           gov.greeting = "Gr_Christofor Manuel de Alencar";
         break;
         case PIRATE:
           gov.greeting = "Gr_Isenbrandt Jurcksen";
         break;
         case HOLLAND:
           gov.greeting = "Gr_Reynard Grueneveldt";
         break;
         case PORTUGAL:
           gov.greeting = "Gr_Jacinto Arcibaldo Barreto";
         break;
         case AMERICA:
           gov.greeting = "Gr_Robert Christopher Silehard";
         break;
       }
       SetModelFromID(gov, GetRandomModelForTypeExSubCheck(-1, "Rich_citizens", "man", iNation)); // PB: Give this guy a random model
     }
Away are all the extra pre-defined potential characters used so you'll always get a random one.

Away is all the .old code so once a governor is replaced, that name and model will not return even when the town is given back to the original nation.
I figure that might just be fair enough because why would the very original governor return? That governor may not even be alive anymore! :shock

Taking over a pirate town will maintain a pirate governor instead of removing the governor altogether.
This wasn't the case before, but fits in with the "Pirate Play Style" changes we've been making this year.

The code also doesn't care about "bFirstInit" anymore which used to apply when the function is called through ModifyTown.
As far as I can tell, that function isn't even used anyway these days so this shouldn't make a difference.
I figure that perhaps was intended for when a town changes hands for the Periods mod.
But that now seems to be handled differently with the governors being defined through Periods.c .

Does this make sense to you guys? Anyone care testing some town captures and seeing what happens with this?
Also, confirm if for example the Spanish governors for normally non-Spanish towns in Early Explorers still are who they're supposed to be according to Periods.c .
 
This is where the Period-dependent governors are set in the AddTown function (same file):
Code:
  if (CheckAttribute(rPeriod, "Towns." + stmp + ".gov")) {
     chr = GetTownGovernor(stmp);
     makearef(archr, rPeriod.Towns.(stmp).gov);
     if (CheckAttribute(archr, "name")) {
       chr.old.name = archr.name;
       chr.name = TranslateString("", chr.old.name);
     }
     if (CheckAttribute(archr, "middlename")) {
       chr.old.middlename = archr.middlename;
       chr.middlename = TranslateString("", chr.old.middlename);
     } else {
       if (CheckAttribute(chr, "middlename")) DeleteAttribute(chr, "middlename");
     }
     if (CheckAttribute(archr, "nickname")) {
       chr.old.nickname = archr.nickname;
       chr.nickname = TranslateString("", chr.old.nickname);
     } else {
       if (CheckAttribute(chr, "nickname")) DeleteAttribute(chr, "nickname");
     }
     if (CheckAttribute(archr, "lastname")) {
       chr.old.lastname = archr.lastname;
       chr.lastname = TranslateString("", chr.old.lastname);
     }
     if (CheckAttribute(archr, "sex")) chr.sex = archr.sex;
     if (CheckAttribute(archr, "model")) SetModelFromID(chr, archr.model);
     if (CheckAttribute(archr, "greeting")) chr.greeting = archr.greeting;
   }
So indeed it looks like that whole ModifyTown affair doesn't do anything.
 
ref gov = &characters[govidx];
gov.nation = iNation;
if (iNation != PERSONAL_NATION)
{
SetRandomNameToCharacter(gov);
switch(iNation)
{
case ENGLAND:
gov.greeting = "Gr_Robert Christopher Silehard";
break;
case FRANCE:
gov.greeting = "Gr_joseph claude le moigne";
break;
case SPAIN:
gov.greeting = "Gr_Christofor Manuel de Alencar";
break;
case PIRATE:
gov.greeting = "Gr_Isenbrandt Jurcksen";
break;
case HOLLAND:
gov.greeting = "Gr_Reynard Grueneveldt";
break;
case PORTUGAL:
gov.greeting = "Gr_Jacinto Arcibaldo Barreto";
break;
case AMERICA:
gov.greeting = "Gr_Robert Christopher Silehard";
break;
}
SetModelFromID(gov, GetRandomModelForTypeExSubCheck(-1, "Rich_citizens", "man", iNation)); // PB: Give this guy a random model
}


This code the simplified version that you suggested, do I implement it on the console file? Do I put it under these:
void ExecuteConsole()
{
ref pchar = GetMainCharacter();
ref ch;
int i;
int limit;
ch = CharacterFromID("Dutch Emissary");
ch.Dialog.Filename.GroupDialog = "governor.c";
ch = CharacterFromID("English Emissary");
ch.Dialog.Filename.GroupDialog = "governor.c";
ch = CharacterFromID("Portuguese Emissary");
ch.Dialog.Filename.GroupDialog = "governor.c";
ch = CharacterFromID("Thomas Modiford");
ch.Dialog.Filename.GroupDialog = "governor.c";
 
You put that code where the old code is as per the first line of my opening post. :cheeky
It won't do anything until you take a new town as that is when it is executed.
 
Ah ok lol
At least my 45 minutes taking charlestown didn't totally go to waste, it's in friendly hands :p
I'll figure this code out tomorrow, now my head is spinning and better hit the sack!

Thanks a lot for all your invaluable support mate; enjoy the night.
 
So the first line you wrote :

int govidx = GetTownGovernorIndex(town);
if (govidx >= 0) {
ref gov = &characters[govidx];
gov.nation = iNation;
if (iNation != PERSONAL_NATION) {

Do I keep this or replace the entire thing as per the one you said "simplified version"?
 
LOL i think i messed up the game :p

21.jpg

Must have put wrong codings and now game won't start
 

Attachments

  • Towntable.c
    61.3 KB · Views: 99
Last edited:
Better put the old file back. I'll post my version tonight if I remember.
 
Yep, good thing I posted the old file in the previous thread "Dutch envoy...."
Or else I would have been stuck without POTC for a very long time :p
 
Yep, good thing I posted the old file in the previous thread "Dutch envoy...."
Or else I would have been stuck without POTC for a very long time :p
As promised, see attached.
 

Attachments

  • Towntable.zip
    15.1 KB · Views: 96
Thanks a lot buddy; I'll give it a try soon!
I see now I kind of did the similar as you did except I put them in the wrong TAB.. it's kind of hard for me to figure out how many TABS to press to align each script, especially the } { signs are confusing.
 
@Grey Roger or @ANSEL or @Hylie Pistof: Does anyone have any comments on the logic I described above?
I am vastly simplifying the functionality there and I want to know if anyone could think of any unwanted side-effects from that.
 
I'd say move the model setting to the case. Then you could make sure for pirates he looks a bit different.
and maybe (for fun) add a little chance of it being a women :p? Although that probably screws up the dialog.
 
Be warned - female models often cause graphics problems if they sit as governors, even some types which appear correct when sitting in taverns. This is probably why, when you go into Port au Prince town hall, Contre-Amiral Beauregard is no gentleman. He's sitting and the lady governor is standing because if she sits down, the graphics go wrong.
 
I'd say move the model setting to the case. Then you could make sure for pirates he looks a bit different.
You mean to use a different model group than "Rich_Citizens" for PIRATE?
Could be done, of course. But we could also set up appropriate pirates Rich_Citizens in initModels.c .

and maybe (for fun) add a little chance of it being a women :p? Although that probably screws up the dialog.
Indeed female governors tend to not work very well, so I'm inclined to avoid those where possible.
Probably wouldn't be very historically accurate anyway. We do have one of them by default in Port au Prince, for variety's sake.
 
Does anyone have any objections to always placing a random governor here?
It seems to work, so then we can consider this "Fixed" and I can clear out all the old code related to the old system.
 
Yes everything seems fine in my Marigot capture except one tiny issue it may be a bug or maybe not.. you know when you walk to a building, it then automatically records in your list of fast walk?
It worked for store, mansion, dock, tavern, but not for church.

I attached error file in case one of these codes is related to this problem.


EDIT: I tried several times, but church cannot be entered.. went outside jungle then back, outside port sea then back.. went to open map and back to Marigot but still..
although it has unlock screen as you can see in the pic. Also attached save file of me standing infront of church in city I captured, Marigot.
59.jpg
 

Attachments

  • error.log
    278 bytes · Views: 79
  • FreePlay.rar
    1.4 MB · Views: 69
Last edited:
Back
Top