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

Unconfirmed Bug Officers hit by player turn hostile at sea

Tingyun

Corsair
Storm Modder
Filing a dedicated report for this bug on behalf of Eskhol. He originally reported it here: Unconfirmed Bug - Retriggering broken weapon enemies as hostile | PiratesAhoy!

At land, attacking officers works fine, they don't take damage and don't turn hostile.

But on your ship's deck, if you attack an officer, all officers in the scene (not just the one hit) turn hostile to the player. Meanwhile, all sailors turn hostile to the officers. Your officers and sailors slaughter each other, all in response to one mistaken strike.

Eskhol also reports the same is true in boarding actions (@imado552 could you test and confirm this part please? I am not able to play right now).

Perhaps the officers are set as a separate relation group from players while at sea?
 
Then a simple fix is possible hopefully? Hope coming from me being ignorant of whether that is true. ;)
 
The line of code is probably simple enough. Finding where to put that line may be more tricky.
Also have to consider what happens with Mutiny, since then you DO want a fight to be possible.
 
i did some tests and its true officer will attack you when you hit them on deck and they would die (unless you died first) here is a screenshot i toke while fighting my officer in a save game i had in my ship deck (sorry mygreat loyal officer i killed you for testing sake T-T!!)
2016_08_31_201140.jpg
so i think its a confirmed bug !!
 
Sounds like something which can be fixed easily. Kicked up to remember myself, and would love it if someone tests it.
@DeathDaisy maybe?
 
@DeathDaisy could you maybe in characters_login take the function LoginCharactersInLocation and add the following trace commands. Then load a game and go to the shipdeck and then post the compile.log?
Code:
void LoginCharactersInLocation(ref loc)
{
    int i;
    string locID = loc.id;
    LocAi_Init(loc);
    for (i = 0; i < MAX_CHARACTERS; i++)
    {
        if (loc.type == "Dungeon" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
            continue;
        } // NK based on BOAL 05-05-01 dungeons count as boarding, Swindler added CheckAttribute() to avoid runtime errors
        if (loc.type == "Deck" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
            continue;
        } // KK
        LoginCharacter(&Characters[i], locID);
        trace("Character = "+&Characters[i].id+" group = "+&Characters[i].chr_ai.group);
        ReloadProgressUpdate(); //Levis
    }
    if(actLoadFlag)
    {
        for(i = 0; i < 32; i++)
        {
            LoginCharacter(&Characters[LOC_FANTOM_CHARACTERS + i], locID);
        }
    }
    LocAi_PostInit(loc);

    if(!actLoadFlag) Build_again(loc);    // ccc building kit, restores buildings
}
 
@DeathDaisy could you maybe in characters_login take the function LoginCharactersInLocation and add the following trace commands. Then load a game and go to the shipdeck and then post the compile.log?
Code:
void LoginCharactersInLocation(ref loc)
{
    int i;
    string locID = loc.id;
    LocAi_Init(loc);
    for (i = 0; i < MAX_CHARACTERS; i++)
    {
        if (loc.type == "Dungeon" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
            continue;
        } // NK based on BOAL 05-05-01 dungeons count as boarding, Swindler added CheckAttribute() to avoid runtime errors
        if (loc.type == "Deck" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
            continue;
        } // KK
        LoginCharacter(&Characters[i], locID);
        trace("Character = "+&Characters[i].id+" group = "+&Characters[i].chr_ai.group);
        ReloadProgressUpdate(); //Levis
    }
    if(actLoadFlag)
    {
        for(i = 0; i < 32; i++)
        {
            LoginCharacter(&Characters[LOC_FANTOM_CHARACTERS + i], locID);
        }
    }
    LocAi_PostInit(loc);

    if(!actLoadFlag) Build_again(loc);    // ccc building kit, restores buildings
}
cant start the game
Code:
COMPILE ERROR - file: characters\characters_login.c; line: 15
Invalid Expression
COMPILE ERROR - file: characters\characters_login.c; line: 15
invalid syntax
 
another attempt (can't test it here myself :p)

Code:
void LoginCharactersInLocation(ref loc)
{
   int i;
   string locID = loc.id;
   LocAi_Init(loc);
   for (i = 0; i < MAX_CHARACTERS; i++)
   {
       if (loc.type == "Dungeon" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
           continue;
       } // NK based on BOAL 05-05-01 dungeons count as boarding, Swindler added CheckAttribute() to avoid runtime errors
       if (loc.type == "Deck" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
           continue;
       } // KK
       LoginCharacter(&Characters[i], locID);
       aref Chr = &Characters[i];
       trace("Character = "+Chr.id+" group = "+Chr.chr_ai.group);
       ReloadProgressUpdate(); //Levis
   }
   if(actLoadFlag)
   {
       for(i = 0; i < 32; i++)
       {
           LoginCharacter(&Characters[LOC_FANTOM_CHARACTERS + i], locID);
       }
   }
   LocAi_PostInit(loc);

   if(!actLoadFlag) Build_again(loc);    // ccc building kit, restores buildings
}

if it doesn't work try changing the aref to ref
and if it still doesn't work change it to:
ref Chr = Chracters;
 
another attempt (can't test it here myself :p)

Code:
void LoginCharactersInLocation(ref loc)
{
   int i;
   string locID = loc.id;
   LocAi_Init(loc);
   for (i = 0; i < MAX_CHARACTERS; i++)
   {
       if (loc.type == "Dungeon" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
           continue;
       } // NK based on BOAL 05-05-01 dungeons count as boarding, Swindler added CheckAttribute() to avoid runtime errors
       if (loc.type == "Deck" && IsOfficer(&Characters[i]) && CheckAttribute(&Characters[i], "AbordageMode") && makeint(Characters[i].AbordageMode) == 0) {
           continue;
       } // KK
       LoginCharacter(&Characters[i], locID);
       aref Chr = &Characters[i];
       trace("Character = "+Chr.id+" group = "+Chr.chr_ai.group);
       ReloadProgressUpdate(); //Levis
   }
   if(actLoadFlag)
   {
       for(i = 0; i < 32; i++)
       {
           LoginCharacter(&Characters[LOC_FANTOM_CHARACTERS + i], locID);
       }
   }
   LocAi_PostInit(loc);

   if(!actLoadFlag) Build_again(loc);    // ccc building kit, restores buildings
}

if it doesn't work try changing the aref to ref
and if it still doesn't work change it to:
ref Chr = Chracters;
can start but cant load, its stuck on the loading screen :eek:
Code:
RUNTIME ERROR - file: characters\characters_login.c; line: 16
null ap
RUNTIME ERROR - file: characters\characters_login.c; line: 16
no rAP data
RUNTIME ERROR - file: characters\characters_login.c; line: 16
uninitialized aref
RUNTIME ERROR - file: characters\characters_login.c; line: 16
null ap
RUNTIME ERROR - file: characters\characters_login.c; line: 16
no rAP data
RUNTIME ERROR - file: characters\characters_login.c; line: 16
uninitialized aref
 
try it with
ref Chr = Chracters;
instead please
 
try it with
ref Chr = Chracters;
instead please
assume you meant Characters? :p anyway, now I can load, but all locations are devoid of life
Code:
RUNTIME ERROR - file: characters\characters_login.c; line: 15
Incorrect copy from array to single
RUNTIME ERROR - file: characters\characters_login.c; line: 15
Using reference variable without initializing
RUNTIME ERROR - file: characters\characters_login.c; line: 15
no DST
RUNTIME ERROR - file: characters\characters_login.c; line: 15
function 'LoginCharactersInLocation' stack error
 
Let's do it differently :p because I'm lazy to figure out why the aref isn't working.
search in LAi_login.c for this (around line 160)
Code:
    if(res == false) return false;
    chr.chr_ai.login = true;
    LAi_AddLoginedCharacter(chr);
    return true;
}
and add this line before the return:
Code:
trace("Character = "+chr.id+" group = "+chr.chr_ai.group);
 
Let's do it differently :p because I'm lazy to figure out why the aref isn't working.
search in LAi_login.c for this (around line 160)
Code:
    if(res == false) return false;
    chr.chr_ai.login = true;
    LAi_AddLoginedCharacter(chr);
    return true;
}
and add this line before the return:
Code:
trace("Character = "+chr.id+" group = "+chr.chr_ai.group);
yes sir!
 

Attachments

  • compile.log
    4.9 KB · Views: 209
Code:
Character = Blaze group = player
Character = Crewmember_01 group = player
Character = Crewmember_02 group = player
Character = Crewmember_05 group = player
Character = Enc_Officer_3 group =

Okay something is clearly going wrong here.
 
could you add a trace to this if statement
Code:
    if(CheckAttribute(chr, "chr_ai.group") == false)
    {
        chr.chr_ai.group = LAI_DEFAULT_GROUP;
    }
at line 95 and see if it goes in here?
So add a line like
trace("NO GROUP");
 
could you add a trace to this if statement
Code:
    if(CheckAttribute(chr, "chr_ai.group") == false)
    {
        chr.chr_ai.group = LAI_DEFAULT_GROUP;
    }
at line 95 and see if it goes in here?
So add a line like
trace("NO GROUP");
yep, seems hes got a group :eek: tried it twice
 

Attachments

  • compile.log
    9.6 KB · Views: 199
I think LAI_DEFAULT_GROUP is defined as "", so would display as empty.
That is probably happening here.
 
Back
Top