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

Behaviour of Surrendered Captains

I don't see much reason to be forced to kill someone just because he has the same model as one of your officers. If you want to hire him, is up to you to change the outfit or not (maybe you want them to look uniformed). But it doesn't bother me either way, I don't think it's that frquent as to be annoying.
 
I'd suggest keeping that. Just because it is easier to disable something that is already working than to remove it and then have to re-add it again some time.
So at the very least, include it and have it operational. If it is really not wanted, comment out the code, but keep it in place for posterity.
 
@Armada since you started this whole debate, what do you think?
It certainly sounds like an improvement. :onya

One thing I don't agree with, though, is forcing a duel for duplicate character models. I understand the original reasoning behind this system, but from a gameplay perspective, it makes no sense to me.
It's an artificial barrier that restricts player choice without you even knowing why, unless you've seen this code. I believe this should be up to the player to deal with, simple as that.
 
Thanks for the input Armada and Homo Erectus! :)

Ok, fixed things up I think. @Pieter Boelen , can you look the new code over?

In particular, did I definite deathfight as true properly first?

On the pirate nation string issue, the begining of the file has this:

Code:
  string NPC_Meeting, blade, gun, cuirass, reload_locator, old;
   int iNation = sti(NPChar.nation);
   string pNation = XI_ConvertString("p"+GetNationNameByType(iNation));
   if(GetNationNameByType(iNation)=="no nation") pNation = XI_ConvertString("pPirate");
   if(GetNationNameByType(iNation)=="Pirates") pNation = XI_ConvertString("pPirate");


Does that beginning of the file part addresses the interger issue with the pirate term and make the below code work? Or is it not enough and needs to be done differently? Sorry about so many questions!

Also, if it does need to be changed, much later in the file things are set by directly saying if(NPChar.nation!=PIRATE), do I need to change those as well?

Code:
//TY Changed to check on AI reputation, skills, and piracy, and random chance, to engage in extreme act of attacking after surrender.
    bDeathFight = false;
    if(IsCharacterPerkOn(NPChar, "SwordplayProfessional")
    {
        if(frnd() < 0.2)
        {
            if(GetCharacterReputation(PChar) > REPUTATION_NEUTRAL && GetCharacterReputation(NPChar) < REPUTATION_NEUTRAL)
            {bDeathFight = true;}
            if(GetCharacterReputation(PChar) < REPUTATION_NEUTRAL && GetCharacterReputation(NPChar) > REPUTATION_NEUTRAL)
            {bDeathFight = true;}
        }
    }
    if(NPChar.nation=PIRATE)
    {
        if(frnd() < 0.3)
        {
            bDeathFight = true;
        }
    }

I went ahead and pulled the pirate condition out from being dependent on swordplay professional (while reducing chance), so that low level pirates sometimes attack as well.

On the duplicate issue, commented it out in accordance with general opinion, leaving a note as to why it was done for the future.

Code:
//if(IsUsedAlliesModel(NPChar)) { bDeathFight = true; }//MAXIMUS: ally's twin will always be agressive [twin officers looks strange, not so?] TY after discussion generally people believe better to allow player to make choice of changing outfit or otherwise dealing with duplicates
    //MAXIMUS: [if enemy captain is stronger than player, you'll fight with him] <--

So, in effect, now any swordplay professional with opposite reputation has a 20% chance of attacking, and any pirate regardless of skills has a 30% chance of attacking after surrendering.

(meaning a pirate with swordplay professional and opposite rep has a 44% chance of attacking, since he gets two rolls)

File attached EDIT ok correct file attached now
 
Last edited:
Also, if it does need to be changed, much later in the file things are set by directly saying if(NPChar.nation!=PIRATE), do I need to change those as well?
Yes, those need to be changed to either:
Code:
if (iNation != PIRATE) // This one reuses an integer variable defined earlier
Or:
Code:
if (sti(NPChar.nation) != PIRATE) // This one uses the string attribute, but converts it to integer before the check is done

//bool bDeathFight, bAllowCompanion;//MAXIMUS TY after discussion generally people believe better to allow player to make choice of changing outfit or otherwise dealing with duplicates
Are you commenting out the line where the variables are declared? You may not want to do that.... :wp
Plus where did the code for the "model check" itself go?
 
Haha, sorry about that, I had picked the wrong line while writing the post, realized during editing, and already corrected, but forgot to correct the post. Then realized after posting but was too slow editing post to escape your notice :)

Ok, will edit further and fix the issue throughout the file

EDIT just saw your last question--it wasn't deleted, I only ever commented it out, even in the first version.
 
EDIT just saw your last question--it wasn't deleted, I only ever commented it out, even in the first version.
I only looking at your post, not the attachment, and I didn't see it there.
But now it's back, so that's OK. :doff
 
Ok now we have:

Code:
//TY Changed to check on AI reputation, skills, and piracy, and random chance, to engage in extreme act of attacking after surrender.
    bDeathFight = false;
    if(IsCharacterPerkOn(NPChar, "SwordplayProfessional")
    {
        if(frnd() < 0.2)
        {
            if(GetCharacterReputation(PChar) > REPUTATION_NEUTRAL && GetCharacterReputation(NPChar) < REPUTATION_NEUTRAL)
            {bDeathFight = true;}
            if(GetCharacterReputation(PChar) < REPUTATION_NEUTRAL && GetCharacterReputation(NPChar) > REPUTATION_NEUTRAL)
            {bDeathFight = true;}
        }
    }
    if(sti(NPChar.nation) = PIRATE)
    {
        if(frnd() < 0.3)
        {
            bDeathFight = true;
        }
    } 
 
    //if(IsUsedAlliesModel(NPChar)) { bDeathFight = true; }//MAXIMUS: ally's twin will always be agressive [twin officers looks strange, not so?] TY after discussion generally people believe better to allow player to make choice of changing outfit or otherwise dealing with duplicates
    //MAXIMUS: [if enemy captain is stronger than player, you'll fight with him] <--

And in unrelated section of code later I changed to (just a part that checks for same national loyalty)


Code:
if(sti(NPChar.nation) != PIRATE)
                    {
                        if(NPChar.nation==GetServedNation()) // of the same nation
                        {
                            switch(Rand(2))

Everything look good? :)
File attached, I will removed past versions from other posts
 
Last edited:
Ok fixed. NPchar.nation searched throughout the file, no other similar instances.

Was the code working previously then? Or broken throughout? Or just works better now? Just curious.

Submitting to new content.

@GAZ Vodnik , if you install this file, you will only have a small chance of getting duals. Normally I wouldn't recomend a new player install files themselves, but since you seemed very bothered by the old system ("ragequit" as you put it), if you install this into the program/dialog folder, overwriting current file, it might help your concern. There will still be duals, but at a low random chance. If it bothers you to have even the chance of duals, let me know and I'll tell you how to make the chance 0.
 

Attachments

  • Cabinfight_dialog.c
    43.8 KB · Views: 167
Was the code working previously then? Or broken throughout?
I dunno. It can't have been fully broken, since the game still worked.
But it wouldn't be the first time that badly written code doesn't even remotely do what it was actually intended to.
I've caught SO many instances of that over the years, that I completely lost count.
 
Possibly as a result of this, it is impossible to take an officer prisoner. Previously, if you chose the top option, "I have time to decide your fate..." (see first screenshot) you went to a screen in which you could choose to lock him in the brig, offer to hire him, cut them all down, or let the ship go. The option to lock him in the brig no longer appears (see second screenshot). I can't find such an option by picking a different choice in the first screen either.

So either I cut them all down (leads to a duel), try to recruit him (leads to a duel if he refuses) or let the ship go (not much fun if I want that ship).
 

Attachments

  • cabinfight1.jpg
    cabinfight1.jpg
    175.9 KB · Views: 127
  • cabinfight2.jpg
    cabinfight2.jpg
    163.8 KB · Views: 123
@Grey Roger there is another bug in the dialog also, so when trying to fix that I will look at this too.
 
I doubt this bug arose from changes to the cabin fight initial dual check. Wouldn't seem likely, thst gets checked once and then doesn't influence things.

I did alter one other place in the file, to implement a correction Pieter made, so you could check if I somehow goofed up there, though I think I just corrected things as instructed. Search for:
if(sti(NPChar.nation) != PIRATE)

@Levis , I do think it has to do with the other dialog bug with AI captians I've reported generating that error, as the dialog tree that results in it is the same one that @Grey Roger is reporting missing the option here. I provided saved games and error logs over in that bug thread.
 
Won't be around to follow up on this, but wanted to at least help with searching for the source of this bug.

@Grey Roger Can you try the attached file out?

It comments out all the new cabinfight checks (which probably weren't the source of the problem given their position, but just in case), and more importantly:

Changes the below stuff back to the version before implementing Pieter's fixes, so it once again is this:

if(NPChar.nation!=PIRATE)
{
if(NPChar.nation==GetServedNation()) // of the same nation

That part seems to actually be near where the dialogue checks things like whether to capture the captain.

Obviously the old stuff before Pieter's correction was wrong, but maybe it was wrong in some way that accidentally allowed things to work?

Anyway, if the attached file doesn't have the problem, then we know it is from something of the above. If it does have the problem, we know it arose elsewhere.

Have a good week everyone. :)
 

Attachments

  • Cabinfight_dialog.c
    43.8 KB · Views: 175
Obviously the old stuff before Pieter's correction was wrong, but maybe it was wrong in some way that accidentally allowed things to work?
Indeed I wouldn't rule it out!
Wouldn't be the first time that something works OK purely by accident. :rofl
 
@Pieter Boelen had a moment over dinner to boot things up (though on an older version before Levis recent perk changes), and the attached file does allow for the AI captain to be taken prisoner.

I did not have time to uncomment the initial dual chances and confirm it still works, but I am reasonably certain it would. They simply determine whether the AI captain is initially hostile, and wouldn't mess with removing this dialogue option.

I am pretty sure the bug was caused by the fix noted above, correcting the way nation is checked in the dialogue, and somehow the old incorrect way actually works. That part actually appears where the dialogue is checked for options, so I am pretty sure it is the culprit.

Suggestion:

1) uncomment the initial captain dualing part again in the attached file above, it doesn't seem likely to be causing this, but take a look and just double check everything looks right (and make corrections if any are to be made). Or just use the current version from the latest release, but:

2) someone better at coding look and figure out why Pieter's suggested corrections to the nation checks in the dialogue tree somehow made it stop working, when the older seemingly incorrect code seems to work. It could be I somehow messed up in implementing Pieter's fix, or maybe something more complicated is going on. Figure out whether to leave it as it used to be, or use some other correction.

I'm afraid this is probably the last moment of free time I have for at least a week, so I can't help with the above (though I wouldn't understand enough anyway). Bye everyone. :)
 
Last edited:
Back
Top