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

WIP Improve the Crewmembers on Shore Mod

I have a question. The random guards code, which includes @Levis' smuggling addon, has the following section of code:

Code:
      if(GetServedNation() == PIRATE && GetCurrentLocationNation() != PIRATE)   // PB: Link this to acting as a pirate
       {
         Dialog.Text = DLG_TEXT[0] + GetMySimpleName(PChar) + DLG_TEXT[1];
         Link.l1 = DLG_TEXT[2];
         Link.l1.go = "exit";
       }
       else
       {
         if(GetFlagRMRelation(sti(Npchar.nation)) <= REL_WAR && frnd()>0.8)
         {
           Dialog.Text = DLG_TEXT[7] + GetMySimpleName(PChar) + DLG_TEXT[8] + GetNationDescByType(sti(PChar.nation)) + DLG_TEXT[10];
           Link.l1 = DLG_TEXT[9];
           Link.l1.go = "exit";
           LAi_group_SetRelation("random_guards_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
         }
         else
         {
           Dialog.Text = DLG_TEXT[18];
           Link.l1 = DLG_TEXT[19];
           Link.l1.go = "exit";
         }
       }
       //Levis smuggling addon -->
       if(CheckAttribute(Pchar,"quest.Contraband.scout"))
       {
         if(!CheckAttribute(Pchar,"quest.Contraband.Talked") || !CheckAttribute(Pchar,"quest.Contraband.Cardwon"))
         {
           Link.l2 = DLG_TEXT[3];
           Link.l2.go = "patrolquestion";
         }
       }

This has two 'if ' conditions, which seem possible to trigger at the same time. What would happen under those circumstances? Would it be possible to be both a pirate in a non-pirate location and do the contraband scouting quest? It seems to me like it would trigger both lines 0 and 3 at the same time, as well as cases 'exit' and 'patrolquestion'. I think the code should check for the contraband quest first, and have the rest of the dialogue under an 'else', unless you think this code would work fine the way it is.

A different option is to say that we prioritise the pirate conditions first, implying that the player would rather not risk talking to the guards for the sake of the patrol schedule for fear of being recognised as a wanted criminal in the process. This would mean that a pirate would have to get the patrol schedule in some different way. Lines 0 to 2 are currently this:

Code:
"Your name is ",
" right? You look very familiar. Did we meet before?",
"I don't think so. But I should be going now.",

Interestingly, that actually makes it the only instance where you don't get attacked for being a pirate. It is currently safer to talk to the guards when you're a pirate than when you're a non-pirate at war with the nation the guard belongs to. I should probably change that, which seems easy enough. I'll wait for your input though.
 
The different dialog options use 'l1' and 'l2', so the smuggling scouting can appear in addition to that regular text.
Whether it does depends on how the if-statements are 'nested'. If I see correctly, that is already the case, so you could probably keep that as-is.

Lines 0 to 2 are currently this:

Code:
"Your name is ",
" right? You look very familiar. Did we meet before?",
"I don't think so. But I should be going now.",

Interestingly, that actually makes it the only instance where you don't get attacked for being a pirate. It is currently safer to talk to the guards when you're a pirate than when you're a non-pirate at war with the nation the guard belongs to. I should probably change that, which seems easy enough. I'll wait for your input though.
Indeed that is NOT intentional on my part.
It would make much more sense to add the regular "getting into trouble for being a pirate" instead of the guard being perfectly fine with it. :facepalm
 
Allright, i'll make sure it starts making sense. Are there other effective ways to smuggle when you're a pirate though? If you get attacked for being a pirate, there is by my knowledge no way to get the smuggling schedule anymore, but i don't know how the new system works, so correct me if i'm wrong. :type1
 
I've bypassed the problem by making the chance of the guard recognising you as a pirate dependant on your rank with the pirate nation. It's therefore entirely up to the player how much risk they're exposed to; the more you're a pirate, the more you'll be hunted down, and right now pretty much everyone will eventually be after your head. It just didn't make sense for a guard to always be after someone who could have been a pirate in name only. Besides, he's off duty, and the guards are repeatedly stated to be corrupt and/or lazy. :p He'll only go after you if he sees a chance to earn a bonus.

I've also spotted this weirdness:
Code:
      if(GetServedNation() == PIRATE && GetCurrentLocationNation() != PIRATE)   // PB: Link this to acting as a pirate // MT: If serving the pirates and in a non-pirate location, then:
       {
         Dialog.Text = DLG_TEXT[0] + GetMyFullName(PChar) + DLG_TEXT[1];
         Link.l1 = RandSwear() + [11];
         Link.l1.go = "exit";
         switch(makeint(Npchar.nation))
         {
           case ENGLAND : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_057.wav");}break;
           case FRANCE : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_c_018.wav");}break;
           case SPAIN : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_037.wav");}break;
           case HOLLAND : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_008.wav");}break;
           case PORTUGAL : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_038.wav");}break;
           case AMERICA : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_057.wav");}break;
         }
         LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
         Random_Raid("soldiers", 5, makeint(NPchar.nation),"enemy","friend","");
         Diag.TempNode = "exit";
         LAi_group_SetRelation("random_sailors_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
       }

The last line's the odd bit. While i believe it's intended to make the person you're talking to hostile, this person is actually sitting at a table at that point. Does that work? I've noticed a single instance where that line was commented out and replaced by a tavern brawl, but the code up here already summons a group of guards. It's not the only spot it's been coded this way.
 
Last edited:
Allright, i'll make sure it starts making sense. Are there other effective ways to smuggle when you're a pirate though? If you get attacked for being a pirate, there is by my knowledge no way to get the smuggling schedule anymore, but i don't know how the new system works, so correct me if i'm wrong. :type1
That could be tricky, yes. Through the "False Flag Detection chance" in there could be a solution.
But the one you propose sounds plausible as well.

Eventually I would like ALL "recognized as a pirate" code to use the same logic.
Right now it is a 100% certainty from Enc_Walker.c, but ONLY from one of the randomly chosen dialog options.
But that may have to be tweaked. If you have some nice logic to apply, we can use that in the other similar spots too.
That would make "becoming a pirate" less potentially annoying too. :onya

The last line's the odd bit. While i believe it's intended to make the person you're talking to hostile, this person is actually sitting at a table at that point. Does that work? I've noticed a single instance where that line was commented out and replaced by a tavern brawl, but the code up here already summons a group of guards. It's not the only spot it's been coded this way.
Agreed. I see no reason to keep it, so please get rid of it. ;)
 
That could be tricky, yes. Through the "False Flag Detection chance" in there could be a solution.
But the one you propose sounds plausible as well.

Using false flag detection sounds like something that would provide a solution for the player throughout the entire game, which does sound better. I dunno though... my solution sounds a bit more realistic. A false flag won't help you much if you've got wanted posters all over the place.

Eventually I would like ALL "recognized as a pirate" code to use the same logic.
Right now it is a 100% certainty from Enc_Walker.c, but ONLY from one of the randomly chosen dialog options.
But that may have to be tweaked. If you have some nice logic to apply, we can use that in the other similar spots too.
That would make "becoming a pirate" less potentially annoying too. :onya

I would like to make it exactly the same everywhere, but haven't quite done that because of an issue with realism. The pirates have a different reaction based on wether they spot you in a pirate town or not. I could remove that, i suppose, but i've always liked little nuances in dialogue myself. I do think i can manage to make the rest of those pirating instances all the same though. The code i'm going to use for that is this:

Code:
      if(GetServedNation() == PIRATE && GetCurrentLocationNation() != PIRATE)   // PB: Link this to acting as a pirate // MT: If serving the pirates and in a non-pirate location, then:
       {
         if(frnd()<makefloat(GetFame(ref pchar, int iNation)))/12.0) //MT: Meant to make you easier to detect as a pirate as you go up in pirate rank
         {
           Dialog.Text = DLG_TEXT[7] + GetMySimpleName(PChar) + DLG_TEXT[11];
           Link.l1 = DLG_TEXT[9];
           Link.l1.go = "exit";
           LAi_group_SetRelation("random_guards_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
         }
         else
         {
           Dialog.Text = DLG_TEXT[0] + GetMySimpleName(PChar) + DLG_TEXT[1];
           Link.l1 = DLG_TEXT[2];
           Link.l1.go = "exit";          
         }
       }

It's fairly simple really. I've also taken up the habit of clarifying things wherever i can so future modders will have less of a hard time learning what the code means, or alternatively, have an easier time spotting any mistakes i made.

Agreed. I see no reason to keep it, so please get rid of it. ;)

I think it's some remnant of when there were random sailor groups that were actually roaming around on the streets. This code looks like it's been copied over without closely looking at it several times, as well as passed over when it's associated mods were changed. I'll get rid of those bits, but it's still a bit weird: Some random sailor in a tavern sicks a gang of people on you and does nothing himself, and if you beat the tavern brawl, what happens then? I've noticed that whenever there's a hostile conclusion it says 'Diag.TempNode = "exit";' while it says 'Diag.TempNode = "first time";' for friendly or neutral ones, but would that work if the instigator of the fight is still alive afterwards, since he's still sat at his table? 'first time' is the name of the case which contains most of the dialogue.[/QUOTE]
 
Using false flag detection sounds like something that would provide a solution for the player throughout the entire game, which does sound better. I dunno though... my solution sounds a bit more realistic. A false flag won't help you much if you've got wanted posters all over the place.
"False Flag Detection Chance" is just that: A chance that you are discovered.
This could be used to detect false flags at sea, but also for anything else where it seems appropriate.
Technically it doesn't have any relation to "flags" at all, though that is what it was originally added for.

I would like to make it exactly the same everywhere, but haven't quite done that because of an issue with realism. The pirates have a different reaction based on wether they spot you in a pirate town or not. I could remove that, i suppose, but i've always liked little nuances in dialogue myself. I do think i can manage to make the rest of those pirating instances all the same though. The code i'm going to use for that is this:
Also fine by me. :doff

But this:
Code:
if(frnd()<makefloat(GetFame(ref pchar, int iNation)))/12.0)
Should probably be this:
Code:
if(frnd()<makefloat(GetRank(pchar, sti(NPChar.nation))))/12.0)

It's fairly simple really. I've also taken up the habit of clarifying things wherever i can so future modders will have less of a hard time learning what the code means, or alternatively, have an easier time spotting any mistakes i made.
That's good practice for sure! I do always try to do the same, but have to admit that sometimes I am better at it than other times.
Thankfully the new Nation Relations behaviour, for example, is something that I DID properly comment on in the code. :cheeky

if you beat the tavern brawl, what happens then? I've noticed that whenever there's a hostile conclusion it says 'Diag.TempNode = "exit";' while it says 'Diag.TempNode = "first time";' for friendly or neutral ones, but would that work if the instigator of the fight is still alive afterwards, since he's still sat at his table? 'first time' is the name of the case which contains most of the dialogue.
Not sure. I've never tried setting TempNode to "Exit". Maybe that would make "talking to that character" immediately skip to exiting the dialog?
 
"False Flag Detection Chance" is just that: A chance that you are discovered.
This could be used to detect false flags at sea, but also for anything else where it seems appropriate.
Technically it doesn't have any relation to "flags" at all, though that is what it was originally added for.

Ahh, of course. That actually explains a fair bit of the code i'm working with as well. I did find it odd that it seemed to prioritise flags a lot of the time, but it wasn't actually checking for flags at all. I'll have to look over the code again to see what i'll do with that knowledge. Might replace some fame checks with the false flag detection then, like you initially suggested.

Not sure. I've never tried setting TempNode to "Exit". Maybe that would make "talking to that character" immediately skip to exiting the dialog?

Sounds like something that would need testing. It is actually a bit questionable wether people will notice though. In my case i either GTFO as soon as a taverbrawl starts, or right after. With everyone getting stuck on the stairs and such they often result in dead officers or previously uninvolved NPC's. Speaking of which though, the tavernbrawl code i saw earlier is as follows:

Code:
      if(GetFlagRMRelation(sti(Npchar.nation)) <= REL_WAR && frnd()>0.8)
             {
               Dialog.Text = DLG_TEXT[17];
               Link.l1 = DLG_TEXT[18];
               Link.l1.go = "exit";
               //LAi_group_MoveCharacter(Npchar, LAI_GROUP_MONSTERS);
               //LAi_group_SetRelation("random_sailors_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
               switch(makeint(Npchar.nation))
               {
                 case ENGLAND : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_056.wav");}break;
                 case FRANCE : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_a_048.wav");}break;
                 case SPAIN : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_042.wav");}break;
                 case PIRATE : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_b_052.wav");}break;
                 case HOLLAND : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_043.wav");}break;
                 case PORTUGAL : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_b_042.wav");}break;
                 case AMERICA : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_056.wav");}break;
               }
               if(TAVERNBRAWL_FROMDIALOG)
               {// TIH -->
                 PChar.TAVERNBRAWL = true;
                 if(frnd()<=0.1)
                 {LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");}
                 DeleteAttribute(PChar,"TAVERNBRAWL");
               }// TIH <--
               Diag.TempNode = "exit";
             }

Does it make sense? I need to make sure before i start copying things. I'm not sure how if(TAVERNBRAWL_FROMDIALOG) is ever met, and the additional random chances seem very odd. I'd remove the one combined with false flag right away, and the other one in the tavernbrawl code also seems a bit much. Then again, i suppose that one doesn't really do any harm. I'll need to check if the enemy type makes sense as well. I'll definitely make tham a "soldier" type in some places.
 
TAVERNBRAWL_FROMDIALOG is defined as '1', so that is ALWAYS true. Unless someone decides to disable it in InternalSettings.h .

Code:
PChar.TAVERNBRAWL = true;
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");
DeleteAttribute(PChar,"TAVERNBRAWL");
^ That code looks to be the correct way of triggering a tavern brawl.
The adding of that "player attribute" and deleting it again afterwards seems to be to convince the enemies generated in a tavern brawl to use only their fists.
That to make it seem like an actual tavern brawl, rather than yet another swordfight.

If you do such a "Random Raid" with soldiers, you may want to not do that. ;)
 
TAVERNBRAWL_FROMDIALOG is defined as '1', so that is ALWAYS true. Unless someone decides to disable it in InternalSettings.h .

Code:
PChar.TAVERNBRAWL = true;
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");
DeleteAttribute(PChar,"TAVERNBRAWL");
^ That code looks to be the correct way of triggering a tavern brawl.
The adding of that "player attribute" and deleting it again afterwards seems to be to convince the enemies generated in a tavern brawl to use only their fists.
That to make it seem like an actual tavern brawl, rather than yet another swordfight.

If you do such a "Random Raid" with soldiers, you may want to not do that. ;)

Yes, i see. :p Does that mean i should still add the attribute but not delete it for the soldiers, or should i neither add nor delete it?
 
Yes, i see. :p Does that mean i should still add the attribute but not delete it for the soldiers, or should i neither add nor delete it?
As soon as you add the attribute, it starts to take effect. The deleting is just to clean up so it doesn't affect any enemies generated after the tavern brawl starts.
So for soldiers who you want to be equipped with swords, simply use:
Code:
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");
Same thing, but two lines less code. ;)
 
I´ve made a rather interesting observation. The detection chance is dependent on leadership, and not national rank and/or fame rank, right? Could be wrong, but besides the point: The realisation i've had is that leadership is actually a fairly good indicator of fame by itself, since the way you get leadership is by completing quests, meaning that the higher your leadership is, the more significant your deeds have been and the more people you've talked to. The idea of making recognition in the dialogue tree based on leadership was therefore not even such a bad idea as i thought it was. The trick is looking at how you raise your leadership skill, rather than what the skill's actually used for.

The reason i'm bringing it up is because i'm questioning what's actually a better indicator of fame: fame rank, or leadership? In beta 3.4, and in many versions before that, i haven't really seen my fame increase no matter what i did, but if fame increases properly in more recent mods, that won't matter.
 
Last edited:
I´ve made a rather interesting observation. The detection chance is dependent on leadership, and not national rank and/or fame rank, right?
Here is the full function for your reference:
Code:
float GetChanceDetectFalseFlag()
{
   // original code -->
   //   float rank = GetRankFromPoints(GetScore(GetMainCharacter()));
   //   return CHANCE_DETECT_FALSE_FLAG_BASE+(CHANCE_DETECT_FALSE_FLAG_MAX-CHANCE_DETECT_FALSE_FLAG_BASE)*rank/MAX_RANK;
   // original code <--

   // PB -->
   if (iForceDetectionFalseFlag ==  1)   return 1.0;
   if (iForceDetectionFalseFlag == -1)   return 0.0;
   // PB <--

   // LDH -->
   ref mchr = GetMainCharacter(); // KK
   float score  = GetScore(mchr); // KK
   float rank  = GetRankFromPoints(score);
   int  sneak  = CalcCharacterSkill(mchr, SKILL_SNEAK);
   int difficulty = GetDifficulty();
   float chance = rank/MAX_RANK * (11.0-sneak)/10.0;
   chance = chance * difficulty/2.0;     // 0.5, 1.0, 1.5, 2.0
   if(IsCharacterPerkOn(mchr, "Disguiser")) chance = chance * 0.9;
   //   chance = chance * (difficulty+1)/3.0;     // alternate difficulty calculation 0.67, 1,0, 1.33, 1.67
   chance = fclamp(CHANCE_DETECT_FALSE_FLAG_BASE, CHANCE_DETECT_FALSE_FLAG_MAX, chance); // PURSEON: so chance doesn't go over min/max
   //   LogIt("False Flag Detection - Score: " + score + ", rank: " + rank + ", Sneak: " + sneak + ", Chance: " + chance*100.0 + "%"); // for testing
   //   LogIt("The chance of your false flag being detected is " + chance*100.0 + "%");   // Tell the player, it might get him used to looking for it.
   return chance;
   // LDH <--
}
So it doesn't look at Leadership. The only skill that DOES factor in is "Luck/Sneak".

Fame IS factored in. But I will probably change how that works at some point in the future.
I've got in mind to "multiply your fame points by your reputation" in some way.
So if your reputation is "Neutral", then by default you would have a low Score/Fame.
You can then become famous either by becoming a Hero OR a Bloody Terror.

This will be tackled in Beta 5, but not before. There I want to make it much harder to get to either extreme of the Reputation scale.
So for now, I'd suggest getting the basic logic working in a clear, clean and simple way. The balancing will probably end up changing later anyway. :wp
 
Fame IS factored in. But I will probably change how that works at some point in the future.
I've got in mind to "multiply your fame points by your reputation" in some way.
So if your reputation is "Neutral", then by default you would have a low Score/Fame.
You can then become famous either by becoming a Hero OR a Bloody Terror.

This will be tackled in Beta 5, but not before. There I want to make it much harder to get to either extreme of the Reputation scale.
So for now, I'd suggest getting the basic logic working in a clear, clean and simple way. The balancing will probably end up changing later anyway. :wp

I figured as much. As long as it gets done eventually, i'll just keep using fame.

One thing though: You said a false flag detection can only happen when at war with a nation, but i see no check to see if you're at war in that code. What's up with that?
 
One thing though: You said a false flag detection can only happen when at war with a nation, but i see no check to see if you're at war in that code. What's up with that?
That function just returns "the theoretical chance value that a false flag IS detected".
The actual checking is done outside that function. Here in PROGRAM\Screwface_functions.c to be exact:
Code:
bool CheckForMainCharacterfalseflag(ref chr, float visibility_range, float ship_range)
{
   if (IsCompanion(chr))             return false; // Companions don't care
   if (CheckForPirateException(chr))       return false; // You are friendly to the pirates, flying a pirate flag and the town is tolerant of pirates
   if (GetAttribute(chr, "skipFalseFlag"))     return false; // Quest ship that will always believe your false flag

   ref PChar = GetMainCharacter();

   bool Recognized = false;
   float chance = 1 - (ship_range / visibility_range);
   float randVal = frnd();
   if (SeaAI_GetRelation(sti(chr.index), sti(PChar.index)) != RELATION_ENEMY && GetNationRelation(PERSONAL_NATION, sti(chr.nation)) == RELATION_ENEMY)
   {
     if (ship_range < visibility_range)
     {
       chance = 0.5 + chance; // 0.5 will be decreased if you are too easily recognized
       chance = chance * GetChanceDetectFalseFlag();
     //   chance = 1.0;
       if(randVal <= chance)
       {
         Trace("FLAGS: The " + GetMyShipNameShow(chr) + " has recognized our false " + GetNationDescByType(GetCurrentFlag()) + " flag at range=" + ship_range + " with visibility=" + visibility_range + ", chance=" + chance + " and frnd=" + randVal);
         Recognized = true;
         SetGroupHostile(chr, false); // They start firing on you, so it is no immediate betrayal
       }
     }
   }
   return Recognized;
}
So you're very much correct that the "only when at war with a nation" check is NOT in there.
 
That function just returns "the theoretical chance value that a false flag IS detected".
The actual checking is done outside that function. Here in PROGRAM\Screwface_functions.c to be exact:
Code:
bool CheckForMainCharacterfalseflag(ref chr, float visibility_range, float ship_range)
{
   if (IsCompanion(chr))             return false; // Companions don't care
   if (CheckForPirateException(chr))       return false; // You are friendly to the pirates, flying a pirate flag and the town is tolerant of pirates
   if (GetAttribute(chr, "skipFalseFlag"))     return false; // Quest ship that will always believe your false flag

   ref PChar = GetMainCharacter();

   bool Recognized = false;
   float chance = 1 - (ship_range / visibility_range);
   float randVal = frnd();
   if (SeaAI_GetRelation(sti(chr.index), sti(PChar.index)) != RELATION_ENEMY && GetNationRelation(PERSONAL_NATION, sti(chr.nation)) == RELATION_ENEMY)
   {
     if (ship_range < visibility_range)
     {
       chance = 0.5 + chance; // 0.5 will be decreased if you are too easily recognized
       chance = chance * GetChanceDetectFalseFlag();
     //   chance = 1.0;
       if(randVal <= chance)
       {
         Trace("FLAGS: The " + GetMyShipNameShow(chr) + " has recognized our false " + GetNationDescByType(GetCurrentFlag()) + " flag at range=" + ship_range + " with visibility=" + visibility_range + ", chance=" + chance + " and frnd=" + randVal);
         Recognized = true;
         SetGroupHostile(chr, false); // They start firing on you, so it is no immediate betrayal
       }
     }
   }
   return Recognized;
}
So you're very much correct that the "only when at war with a nation" check is NOT in there.

Whew. Would have been pretty bad if that was a mistake. :cheeky

Concerning the progress of my modifications, the pirates and random guards are pretty much done, but i keep coming up with new ways to streamline things or make things make more sense. The current versions do seem functional to me though. I'm just waiting to see if i can get the random sitting sailors to work too before i upload the files, since fixing it may involve new changes for the other files.
 
Concerning the progress of my modifications, the pirates and random guards are pretty much done, but i keep coming up with new ways to streamline things or make things make more sense. The current versions do seem functional to me though. I'm just waiting to see if i can get the random sitting sailors to work too before i upload the files, since fixing it may involve new changes for the other files.
No worries. If you can post your changes at the end of the weekend, I can add them to a new update on Monday. :yes
 
No worries. If you can post your changes at the end of the weekend, I can add them to a new update on Monday. :yes

I am aware, yes. :yes

Here's another question: Do you remember exactly why the tavernbrawl toggle was implemented? Some tavern fights that this code creates are prevented by the toggle (namely the ones that involves unarmed combatants), while the soldiers invading the tavern are not. I'm asking because the spirit of the toggle is quite important here. If it was implemented because people didn't want fights to happen in taverns at all, then the soldiers should also be held in check by the toggle.

I've also noticed that internalsettings has a toggle for tavernbrawlers to fight with their fists, while the code i found in the dialogue doesn't take this toggle into account. I've devised the following code to fix that, but i suspect it could be done more efficiently. Can it?

Code:
                  if (TAVERNBRAWL_FISTSONLY)
                   {
                     PChar.TAVERNBRAWL = true; //MT: makes spawned enemies fight with their fists
                   }
                   {LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
                   Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");}
                   if (TAVERNBRAWL_FISTSONLY)
                   {
                     DeleteAttribute(PChar,"TAVERNBRAWL"); //MT: makes spawned enemies fight with their fists
                   }
 
The TAVERNBRAWL_FROMDIALOG toggle is meant to prevent such tavern brawls altogether. Just for people who are annoyed by it.
The TAVERNBRAWL_FISTSONLY is meant to have non-soldier character be generated without swords/guns.
Maybe some of those toggles could be removed altogether.

I've also noticed that internalsettings has a toggle for tavernbrawlers to fight with their fists, while the code i found in the dialogue doesn't take this toggle into account. I've devised the following code to fix that, but i suspect it could be done more efficiently. Can it?

Code:
                  if (TAVERNBRAWL_FISTSONLY)
                   {
                     PChar.TAVERNBRAWL = true; //MT: makes spawned enemies fight with their fists
                   }
                   {LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
                   Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");}
                   if (TAVERNBRAWL_FISTSONLY)
                   {
                     DeleteAttribute(PChar,"TAVERNBRAWL"); //MT: makes spawned enemies fight with their fists
                   }
That seems about right to me. If this is something you have to call often, you could make it a function:
Code:
void Random_Brawl()
{
   ref PChar = GetMainCharacter();
   if (TAVERNBRAWL_FISTSONLY)   PChar.TAVERNBRAWL = true; //MT: makes spawned enemies fight with their fists
   LAi_LocationFightDisable(LoadedLocation, false);
   Random_Raid("smugglers", 5, PIRATE,"enemy","friend",LanguageConvertString(tmpLangFileID,"TAVERNBRAWL") + "!!!!");
   DeleteAttribute(PChar,"TAVERNBRAWL"); //MT: makes spawned enemies fight with normal weapons again
}
Then you can call it with:
Code:
if (TAVERNBRAWL_FROMDIALOG) Random_Brawl();
 
Back
Top