• 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 Crash Due to ClearCharacter Called on Mutinuous Captain

ANSEL

Corsair
Storm Modder
Hearts of Oak Donator
Free play as Will Turner: The crew on my companion ship started mutiny, the ship is
a English fast Galleon, I defeated the mutiny and this happens: seadogs2_0054.jpg
game crash.
I replicated this thing twice.
 

Attachments

  • error.zip
    794 bytes · Views: 143
  • compile.zip
    6.9 KB · Views: 133
  • compile.log
    91.8 KB · Views: 130
  • error.log
    181 bytes · Views: 153
Last edited:
It happens again, the mutiny, this time I have the Galleon and the Frigate as companion ship.
The companion Frigate turns to a Lateen Caravel in the ransack screen, again.seadogs2_0087.jpg
 

Attachments

  • error.log
    8.2 KB · Views: 148
  • compile.log
    27.4 KB · Views: 136
  • -=Player=- Open Sea March 1st, 1751.zip
    938.6 KB · Views: 149
You have fixed the ransack interface, havent you? Thats where this problem are,right?
 
@Mere_Mortal added speed and turn rate to it and I made some corrections to that code a week ago or so.
But if you were already playing with the latest version, apparently this is something new.
 
Alright! I will try and see if the latest update make a difference.
 
I tried with the last update, it still goes wrong, game crash.
Something very odd: My companions crew is now dressed
in Portuguese uniforms (after the mutiny):shock
 

Attachments

  • error.log
    4.7 KB · Views: 157
  • compile.log
    45.5 KB · Views: 141
Looks to me like the mutineer is being deleted. :unsure
Code:
ClearCharacter erases Enc_CabinCaptain_0()
...
ClearCharacter called from FindFreeRandomOfficer
ClearCharacter erases Enc_Officer_0(Joshamee Gibbs)
ClearCharacter called from FindFreeRandomOfficer
ClearCharacter erases Enc_Officer_0()
...
ClearCharacter called from FindFreeCabinCaptain
ClearCharacter erases Enc_Officer_8(Claeyse Rijkaard)
...
LAi_boarding.c -> twin character <Enc_Officer_8> was successfully deleted
...
WARNING!!! Character id = Enc_Officer_8 hav`t ship.
If he’s dead then I guess that’s fine. If so then why is he being replaced with some kind of null character who has no ship?

Then the ship is seemingly replaced with the default Lateen Caravel, which is probably normal under the circumstances.

The lack of stats on the transfer interface is simply because... the ship has no data.

The guy has no nation so the uniforms are probably being randomised.
Code:
XP ERROR: Character  was missing rank during post init
index = 2001
id =
location = none
  locator =
  group =
experience = 1
perks =
  freepoints = 1
skill =
  freeskill = 0
quest =
  officertype = civilian
  officerprice = 0
rank = 1
money = 33
loyality = 10
alignment = bad
homelocation = none
  group =
  locator =
homestate = citizen
name =
lastname =
I berth the companion ship at Soa Jorge shipyard, then regret and relaunched it again, coming out of the
door : water all over town, my ship standing at the church door.
Global warming, matey. :yes
 
Last edited:
Looks to me like the mutineer is being deleted. :unsure
There is indeed code in place to erase characters at certain points during the game, to prevent them from interfering later.

I wonder why FindFreeRandomOfficer or FindFreeCabinCaptain are being called.
And is it "Joshamee Gibbs" or "Claeyse Rijkaard" who used to be the captain of that ship?

The required solution does become obvious: Apparently he's being cleared while he's still required later.
So I'd need to know exactly when he is cleared and where he is at the time that he is cleared.

Global warming, matey. :yes
:rofl
 
It’s Claeyse Rijkaard. He turns up in the cabin and the same thing happens if he dies or is recruited again, so it must be after.

Whichever way it goes, the game crashes. Nothing in the logs about this...

Untitled.jpg

What about not calling the clear character function during boarding?
 
Last edited:
There is code in place to abort ClearCharacter if the character being cleared is in the same location as the player to avoid these problems.
That is why I wonder where the NPC is at the time he's being cleared. You could also try what you suggest though. :doff
 
There could be a more direct fix, but this certainly works. :cheeky
Code:
[PROGRAM\Characters\characters.c]

bool ClearCharacter(ref character)
{
   if (bAbordageStarted || LAi_Boarding_Process || LAi_IsBoardingProcess()) return false;

   int index  = character.index;
   string id  = character.id;
   string entity = "";
   if (CheckAttribute(character, "model.entity")) entity = character.model.entity;
   DeleteClass(character);
   DeleteAttribute(character, "");
   character.index = index;
   character.id = id;
   if (entity != "") character.model.entity = entity;
   character.location = "none";
   character.location.locator = "";
   character.location.group = "";
   character.chr_ai.group = LAI_DEFAULT_GROUP;
   return true;
}
Probably Definitely don’t need bSeaActive, I just ripped this straight out of the loot bug fix.

I had to kill the guy so I don’t know how it will go if he is recruited again, I imagine it would be okay though.
 

Attachments

  • seadogs2_0000.tga.jpg
    seadogs2_0000.tga.jpg
    549.6 KB · Views: 186
Last edited:
There are several checks before the call to 'ClearCharacter' itself; I'd recommend added it there, instead of inside the function itself.
But I can also look into it myself later. After all, it was my clever idea to add that 'ClearCharacter' functionality.... :unsure
 
I’ve just never bothered to look at how clearing characters actually works, so I’d rather not touch anything else. ;)

At least the above option does mitigate it until a more appropriate solution is found.
 
It is PROGRAM\Characters\characters.c .
I'll try to come up with an alternate solution soon, but this should be OK for now. :doff
 
Thanks! I have do something serious about coding , at the time I want to understand
some more about the "Mechanic" of coding. :read
 
You're very welcome to learn. Think of something small and simple you'd like to do and we'll do what we can to help. :doff
 
Back
Top