• 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 GetPatrolTimeText Can Cause Crashes

Mere_Mortal

Free Like a Radical
Storm Modder
Free-play as a pirate, currently at Turks. Guaranteed crash if I talk to anybody other than the barman in the tavern.
Code:
RUNTIME ERROR - file: smuggling.c; line: 962
incorrect argument index
RUNTIME ERROR - file: smuggling.c; line: 962
Bad function argument
RUNTIME ERROR - file: smuggling.c; line: 963
missed attribute: start
RUNTIME ERROR - file: smuggling.c; line: 963
no rAP data
RUNTIME ERROR - file: smuggling.c; line: 964
missed attribute: end
RUNTIME ERROR - file: smuggling.c; line: 964
no rAP data
Code:
string GetPatrolTimeText(ref sisland, int best)
{
   aref patrols;
   makearef(patrols,sisland.smuggling.patrol);
   string patrol = GetAttributeName(GetAttributeN(patrols,best));
   string start = GetTimeText(stf(sisland.smuggling.patrol.(patrol).start));
   string end = GetTimeText(stf(sisland.smuggling.patrol.(patrol).end));
   string text = "between "+start+" and "+end;
   return text;
}
I placed a return at the top of the function and I can now speak to people.
 
Do you have a save from which I can test this?
It may be a quick fix, but I'm not near my computer for a few days so can't look into it yet at the moment.
 
It seems to depend on the dialogue options as to whether or not it crashes - I think it will if somebody will actually talk to me.
Speaking to the barman is okay, so what does appear to be consistent is spawning an officer and then attempting to talk to him.
 

Attachments

  • -=Player=- Turks.7z
    489.5 KB · Views: 239
There should be only two types of characters who use that function in their dialog:
Officers and soldiers in the Tavern.
 
about that every time i talk to my officers on cozumel and on the landing I get this
upload_2016-5-30_14-17-12.png
 

Attachments

  • error.log
    399 bytes · Views: 211
@Mere_Mortal and @llewelyn ravencroft: I think I know why the game would crash there.
In MM's savegame, Turks is PIRATE and therefore has NO smuggling patrols defined. Likewise, there isn't much to smuggle on Cozumel either.

I think this change in PROGRAM\smuggling.c should prevent any errors due to this:
Code:
string GetPatrolTimeText(ref sisland, int best)
{
   aref patrols;
   makearef(patrols,sisland.smuggling.patrol);
   if (GetAttributesNum(patrols) > 0) // PB: Just in case there are no patrols at all
   {
     string patrol = GetAttributeName(GetAttributeN(patrols,best));
     string start  = GetTimeText(stf(sisland.smuggling.patrol.(patrol).start));
     string end  = GetTimeText(stf(sisland.smuggling.patrol.(patrol).end));
     return "between "+start+" and "+end;
   }
   return "";
}

See attached for my copy of the file. :doff

EDIT: Confirmed, this solves the problem.
 

Attachments

  • smuggling.c
    68.7 KB · Views: 192
There can actually be Smuggling patrols on pirate Islands too. But not if the Smuggling Nation of that Island is also pirate.
This is to simulate the idea that another nation may claim ownership over an island, even if they themselves have no settlement there.
 
Ah, that makes a better sense. Still bad for their health, though. xD
If you play in Early Explorers, then often Spain is the "Smuggling Nation" for islands, even if Spain has no settlement there.
This often affects Turks. Also with England in the later time periods.
 
Hey mates been a while since last time I wrote something around here. Well have been playing the newest Mod version and it always radomly crashes. It's kind of annoying but try to avoid any stress by quicksaving a LOT.

Is this normal or is just my pc or my stock game or IDK.

Edit: Was playing in free play with Master & Commander. Now playing the main story.

Save: MEGA
 

Attachments

  • AOP.rar
    693 bytes · Views: 189
  • error.png
    error.png
    1.2 MB · Views: 213
Last edited:
Hey mates been a while since last time I wrote something around here. Well have been playing the newest Mod version and it always radomly crashes. It's kind of annoying but try to avoid any stress by quicksaving a LOT.
What latest game version are you talking about? Post all the .log files from your main game folder after it happens.

Also, I'm moving this to the "Support" forum as without any details, this is no actual bug report.
 
Back
Top