• 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 Unintended Fights

ANSEL

Corsair
Storm Modder
Hearts of Oak Donator
Now guards at taverns at you own and friendly nations is attacking you.
With out a word they draw there blades and goes direct to you.
 

Attachments

  • -=Player=- Bonaire. Kralendijk town February 1st, 1683 1.zip
    826.3 KB · Views: 142
For crying out loud, I already fixed that a few weeks back!

What dialog text do you get on the screen?
 
They don't have a dialog at all. They seem to be placed in a group which is hostile to you....
 
Now guards at taverns at you own and friendly nations is attacking you.
With out a word they draw there blades and goes direct to you.
I think I know what happened. And indeed it doesn't make sense.

You probably got caught by some guards of another nation on another islands and were attacked there.
Which means this code got triggered:
Code:
    case "exit_soldiers":
       Diag.CurrentNode = Diag.TempNode;
       DialogExit();
       LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
       Random_Raid("soldiers", 5, makeint(NPchar.nation),"enemy","friend","");
       LAi_group_SetRelation("random_guards_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
     break;
But ALL guards in taverns are ALWAYS part of the "random_guards_group".
Which means if you anger the French tavern guards, the Dutch tavern guards get angry too.

Of course they should be moved into the CORRECT town guard group.
And then THAT group should be made hostile.

Until I come up with a proper fix, you can execute this through console to "reset" the situation:
Code:
LAi_group_SetRelation("random_guards_group", LAI_GROUP_PLAYER, LAI_GROUP_NEITRAL);
And before you ask, yes that apparent typo is intentional.
 
@Pieter Boelen I think our easiest solution would be to add an attribute to each town which stores the groups for the citizens and the guards. so you can check which group should be picked for the diffent characters, but I had hoped we could wait with that till after the public release.
Maybe the easiest fix now is to add an quest case here which set the relation back to neutral once you exit the location?
 
It isn't MY use of typos; I hate that and often correct it when I find them.
Stock game was made by Russian programmers though and that shows.

@Levis: There are already separate AI groups for each nation's soldiers and citizens.
I am just going to make them join their regular nation guards group.
I see no need for anything else. Should be an easy enough fix; will try to implement it tonight.
 
It isn't MY use of typos; I hate that and often correct it when I find them.
Stock game was made by Russian programmers though and that shows.

@Levis: There are already separate AI groups for each nation's soldiers and citizens.
I am just going to make them join their regular nation guards group.
I see no need for anything else. Should be an easy enough fix; will try to implement it tonight.
How are you going to get the right group?
Will it be something like "SOLDIER_"+nation or something like that? Or will this be another function with a lot of cases for each location?
While at it could you maybe also do it for the enc_walkers and the random sailors etc?
 
How are you going to get the right group?
Will it be something like "SOLDIER_"+nation or something like that?
Pretty much. The function already exists and I used it for when the random sailors call the town guards.

While at it could you maybe also do it for the enc_walkers and the random sailors etc?
You mean to ADD those characters themselves to the relevant AI groups?
If I can find where they're generated, that should be easy enough.

There is a group PER NATION, not per town. So that could be a bit oddish.
But right now I don't care about that. :cheeky
 
@Pieter Boelen in LEnc_Monsters line 1412 and down. There you will find all kinds of different encounters which should be put in the right group.
 
This doesn't sound like something i can fix myself, since it all sounds really complicated. I do wonder why we didn't have this problem before we changed it though. By my knowledge we didn't modify that particular bit, but i'm apparently wrong.
 
@Levis: I think this might do the trick:
Code:
//Levis extra atmosphere -->
void Random_guards_group(int bmax, int nation)
{
   if(bmax==0) return;

   ref chr, chr_prec;
   float hasgun;
   string ani, group, locator;
   hasgun = 0.5;
   ani = "man";
   group = "goto";
   
   for(int i = 0; i < bmax; i++)
   {
     locator = LAi_FindRandomLocator(group);
     chr=LAi_CreateFantomCharacterEx(false, 0, true, true, hasgun, GetRandomModelForTypeExSubCheck(1, "Soldiers", ani, nation), ani, group, locator);
     if(i==0)
     {
       //chr.middlename = "";
       chr_prec = CharacterFromId(chr.id);
     }
     chr.Dialog.filename="random_guards_group_dialog.c";
     LAi_SetCivilianPatrolType(chr);
     if(nation==PIRATE){chr.nation=rand(NATIONS_QUANTITY-1);}
     else{chr.nation = nation;}
     LAi_group_MoveCharacter(chr, GetCurrentSoldierGroup()); // PB: was LAi_group_MoveCharacter(chr, "random_guards_group");
   }
/*   LAi_group_SetRelation(LAI_GROUP_PLAYER, "random_guard_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation("random_pirates_group", "random_guards_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation(LAI_GROUP_GUARDS, "random_guards_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation(LAI_DEFAULT_GROUP, "random_guards_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation(LAI_GROUP_MONSTERS, "random_guards_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation(GetCurrentCitizenGroup(), "random_guards_group", LAI_GROUP_NEITRAL);
   LAi_group_SetRelation(GetCurrentSoldierGroup(), "random_guards_group", LAI_GROUP_NEITRAL);*/
}
//<-- Levis extra atmosphere
But I'm removing a lot of code there. Am I missing something? :confused:
 
That looks good to me.
some more of those groups:


Random_Patrol = guards
Random_sailors_group = citizens
Random_citizens_group = Case 0 should also move to group (check case 1 also please)
Random_guard_sit_tavern = guard
Random_sailors_sit_tavern = citizen
Random_item_traders = add protected? and citizen
 
See attached for some more changes as requested by @Levis. Hopefully this will do some good.

For the next update, I'll replace the "NEITRAL" with "NEUTRAL" and also simplify that code by using these two functions instead:
Code:
string GetSoldiersGroup(int iNation)
{
   string groupName = GetSoldiersName(iNation)+"_SOLDIERS";
   if (groupName == "PERSONAL_SOLDIERS") groupName = LAI_GROUP_PLAYER;
   return groupName;
}

string GetCitizensGroup(int iNation)
{
   string groupName = GetSoldiersName(iNation)+"_CITIZENS";
   if (groupName == "PERSONAL_CITIZENS") groupName = LAI_GROUP_PLAYER;
   return groupName;
}
 

Attachments

  • LEnc_monsters.c
    69.5 KB · Views: 149
@ANSEL: I think the above file should solve the problem on your savegame without requiring a console command.
This immediately makes all those random soldiers part of the DUTCH soldier group, which of course isn't hostile to their own officer. :cheeky
 
@Pieter Boelen
Code:
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
invalid function argument
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
Invalid Expression
COMPILE ERROR - file: LandEncounters\LEnc_monsters.c; line: 1110
invalid syntax
When installing your version
 
Changing "nation" to "iNation" on that line seems to fix it..
 
What is on that line?

I made a lot more changes to my own version and that works, but isn't compatible with the last release version.
So I tried to make a version that is. Might have missed a spot though.
 
Back
Top