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

High Priority Levelling: Some Captains Not Correctly Initialized until Too Late

@salonikasurf and @Hylie Pistof: I have merged the two threads together, because it is pretty much confirmed now that they are due to the same problem.
It seems that the "correctly initialize characters" system that occurs ashore does NOT work in 3D Sailing Mode.

Coast Raiders (random ships surrounding islands) and Worldmap encounters should be OK.
But any quest characters may get affected by this, especially Treasure Quest Pirates, Governor Ship Hunting Quests and Convoy Quest Enemies.

There are two possible solutions:
1. Somehow ensuring that all captains at sea DO go through the Levelling system
2. Planned Feature - Use Generic Captain and Ship Generation Functions | PiratesAhoy!

The first requires someone to figure out why this isn't already happening.
Ideally that someone should be @Levis, since it is his system, after all.

The second needs doing sooner or later anyway because the current way is messy to say the least.
But that requires some good time and effort spent and has a risk of temporarily breaking stuff.

Can we deal with having this bug in the Beta 4 public release, to be fixed later?
 
Was that another Treasure Quest pirate?
My suspicion would be that it does weird things the first time and then not the second.
This is because technically the same character gets reused and never gets reset.
 
So I just finished taking the Marauder frigate off Martinique. It went smoothly except for the constant "sail ho!" messages that had ships popping up all over the place and had the Marauder bouncing all over the map. Until we were finally able to close and capture her. Sigh. The ship was undamaged after the battle. This makes me think this is somehow related to quest ships as other regular ships I captured stayed damaged.
 
It went smoothly except for the constant "sail ho!" messages that had ships popping up all over the place
You know you can toggle all DirectSail updated with the [0]-key (the zero that isn't on the Numpad), right?
That should at least avoid updates while you don't want them.

The ship was undamaged after the battle. This makes me think this is somehow related to quest ships as other regular ships I captured stayed damaged.
Really? Again??? I know why that happened and it was definitely related to certain quest ships.
The problem was when SetBaseShipData gets called for ships AFTER the battle, which isn't meant to be happening.

But I already changed several things so that:
1. ALL ships gets initialized right at the start of the game
2. I removed one piece of code that used to call this again and messed things up
3. Levelling does also call this function for any captain that wasn't properly initialized, BUT I recently added code to initialize any and all captains upon being logged into sea

In other words: I already did a whole bunch of things to prevent this! I'm running out of things to change. o_O

My suggestion:
- Start a new game with the 31 Mar 2016 release that I posted just now (this isn't enforced for you, but I think I have to recommend it for this one anyway)
- Keep an eye on whether this happens again, paying special attention to any quest ships (includes Governor Ship Hunting/Smuggling Coastguard/Escort Quest Enemy)
- If it does happen, try to make the ship surrender so that you can post a savegame

If I have a savegame that is definitely from a new game on the latest modpack update, then that confirms the problem is still not fixed.
Hopefully I can then test it to see why it is still not *** working.
 
My current install is 27 March with the latest zips. Would there be anything in the latest one that this one does not?

I was intending to just keep playing this install until the public release, then starting over.
 
Probably there is not. I think I put all my fixes for this in the last zip.
But I don't remember that for sure.

In any case: still sounds weird and wrong. Dammit. :modding
 
I have to remember to get rid of that message then tomorrow.

If you also happen to have a save with that self repairing ship, I could do a final check on that one as well.
 
Ok. Here are 2 saves. One as we leave port and another just after the battle ends.
 

Attachments

  • -=Player=- Open Sea September 23rd, 1692.7z
    659.5 KB · Views: 285
  • -=Player=- Open Sea September 24th, 1692.7z
    656.2 KB · Views: 285
Ok. Here are 2 saves. One as we leave port and another just after the battle ends.
Problem confirmed. AGAIN! Looks like the captain IS properly initialized, but then it happens again later anyway which is NOT intentional.

So now I'm again tracking down what function is responsible for doing this.

This is just beyond annoying.
 
I now pretty much know what code is responsible for doing this. And I cannot even begin to describe how RIDICULOUS this shit is.
The problem is that 'LAi_Create_Officer' was rewritten by @Levis to completely redo a character's initialization.

When boarding a ship, that function gets called on the captain through @Maximus' 'CreateTwinCharacter' function.
WHY does it do that? I have absolutely NO CLUE. But the combination messes things up quite nicely.

The only solution I can think of is to replace this code in PROGRAM\Loc_ai\LAi_boarding.c:
Code:
// KK -->
   if (!IsFort && !IsTown)
     refEnCharacter = CreateTwinCharacter(boarding_enemy);
   else
     refEnCharacter = boarding_enemy;
// <-- KK
With this:
Code:
// KK -->
//   if (!IsFort && !IsTown)
//     refEnCharacter = CreateTwinCharacter(boarding_enemy); // PB: This causes an unintentional reset of the captain
//   else
     refEnCharacter = boarding_enemy;
// <-- KK
I did that in attached file for testing purposes.

Problem is that I do not know AT ALL if it is safe to do this.
I assume there must have been a reason for that function and with this change it goes completely unused.

Long story short:
This is STUPIDLY COMPLICATED. Everything has been modded to death and different people's code does NOT work together the way it is meant to.
That has really messed up consequences and apart from rewriting from scratch and cleaning everything up, I can think of no real solution.

The attached file MAY solve the problem. Or it could cause even worse problems. I really do not know.

But one thing is certain: This isn't even funny anymore. Holy crap, what a BLOODY MESS! :sick
 
On second thought, I think my earlier suggestion is probably not very wise. File removed.
This will require yet more deliberation.... :modding
 
I think extracting attached file to your PROGRAM folder should be a safer solution.

This time I just got rid of these two lines:
Code:
     if(!CheckAttribute(Fightincabin,"quest.officertype")) Fightincabin.quest.officertype = GetRandomOfficerType(); //Levis let's use a global function so we can easily add types later.
     LAi_Create_Officer(rand(8), &Fightincabin);
So enemy captains you hire will have whatever officer type they had when they were still the captain.
 

Attachments

  • MAXIMUS_Functions.zip
    26.9 KB · Views: 284
Please don't take this wrong, but this is what I was talking about months ago when I was complaining about there being too many big changes coming too fast. It takes time to test stuff properly.

I don't know, should it just be released as is and then continue with patches?
 
There has definitely been too much stuff added that wasn't thought through properly nor finished.
Unfortunately that only became apparent far too late and the person who was working on it vanished.
So last minute I have to clean up the mess that was left. Definitely no good at all.
 
Back
Top