• 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 Nation Relations: Planned Updates

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
This was copied from Discussion - Nation Relations: FINAL(!) Request for Suggestions on a Simplified Mode | PiratesAhoy!

Based on the earlier suggestions, I intend to still make the following changes:

- Governor Ship Hunting quests to DO lose you points with the target nation, but ONLY the target nation.
If the target is friendly/neutral, they would turn immediately hostile. If you had a LoM with the target, you will "leave bad".

- When your actions cause nations to immediately drop down the Wary/Hostile, there will be a Questbook entry to let you know it happened and why.
Otherwise it may be a bit "invisible" when it happens and cause surprises later.

Does that sound about right? Did I miss anything?
 
Last edited:
- When your actions cause nations to immediately drop down the Wary/Hostile, there will be a Questbook entry to let you know it happened and why.
Otherwise it may be a bit "invisible" when it happens and cause surprises later.
I made a start on this one by adding the following code:
Code:
           relChange = rel  -  REL_AFTERATTACK + 1;                         // You may immediately become Wary with this nation
           if (makeint(rel) <= REL_AFTERATTACK)             relChange = fPoints;     // They are already Wary, so just subtract the number
           else                                           // Else, add an explanatory text message
           {
             Preprocessor_AddQuestData("AllyNation"  , GetNationDescByType(i));
             Preprocessor_AddQuestData("AttackNation", GetNationDescByType(iNation));
             if (!CheckActiveQuest("relations_book")) SetQuestHeader("relations_book");
             AddQuestRecord("relations_book", 4);
             Preprocessor_Remove("AllyNation");
             Preprocessor_Remove("AttackNation");
           }
Plus this line for the Questbook entry:
Code:
text.t4=The #sAllyNation# government turned wary of me because of my attack on their #sAttackNation# allies.
That works fine the FIRST time, but NOT on any subsequent calls.
It DOES add the additional entry, but changes the texts on the FIRST entry too. And then it just all stops making sense. :facepalm
 
So instead, I'm adding it to the Ship's Log now:
Code:
             string sLogTitle = GetNationNameByType(i) + " turned Wary of me";
             string sLogEntry = "The " + GetNationDescByType(i) + " government turned wary of me because of my attack on their " + GetNationDescByType(iNation) + " allies.";
             WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
And to make it more obvious when that happens, I'm adding the following code to be executed for ALL Ship's Log entries:
Code:
   // PB: Sound and on-screen effects -->
   Log_SetStringToLog(XI_ConvertString("Ship Log Update"));
   AddMsgToCharacter(pchar,MSGICON_LOGBOOK);
   PlaySound("INTERFACE\notebook_01.wav");
   // PB: Sound and on-screen effects <--
 
- Governor Ship Hunting quests to DO lose you points with the target nation, but ONLY the target nation.
If the target is friendly/neutral, they would turn immediately hostile. If you had a LoM with the target, you will "leave bad".
Simplest solution is to just call the 'AttackRMRelation' function like this:
Code:
      // PB: Add relation points -->
       float points  = stf(GetAttribute(CharacterFromID("Quest pirate"), "Points"));
       if (points < 1.0) points = 1.0;
       if (!IsInServiceOf(iNation)) // Prevent becoming MORE than Friendly if you're not yet in the service
       {
         float rel = GetRMRelation(pchar, iNation);
         if (makeint(rel) <= REL_NEUTRAL && rel + points >= REL_NEUTRAL)   points = -rel;
       }
       ChangeRMRelation(pchar, iNation, points);
       AttackRMRelation(pchar, sti(pchar.quest.generate_kill_quest.nation) );
       // PB: Add relation points <--
So that triggers the following code:
Code:
//run this whenever friendly or neutral thing of iNation is /attacked/ by char.
float AttackRMRelation(ref char, int iNation)
{
   bool bad = false;
   float rel = GetRMRelation(char, iNation);
   if(rel > REL_NEUTRAL)                                     // Relation is Friendly or better
   {
     bad = true;                                         // Leave service on BAD terms
     ChangeCharacterReputation(char, REPCH_FRIENDLY);                     // Lose 30(!) reputation points
     SetRMRelation(char, iNation, REL_AFTERATTACK);                       // You immediately become WARY with this nation
   }
   else
   {
     if(rel > REL_AFTERATTACK)                                 // Relation is above Wary
     {
       ChangeCharacterReputation(char, REPCH_NEUTRAL);                     // Lose another 1 reputation point
       SetRMRelation(char, iNation, REL_AFTERATTACK);                     // You immediately become WARY with this nation
     }
     else
     {
       if(GetRMRelation(char, iNation) > REL_WAR) SetRMRelation(char, iNation, REL_WAR);   // You immediate become HOSTILE with this nation!
     }
   }
   LeaveService(char, iNation, bad);                               // Leave service with this nation
   return GetRMRelation(char, iNation); // NK 04-09-20 func must return something, it's a float. Oops!
}
Which means that you won't ever get lower than hostile this way.
But at least you WILL become hostile eventually, rather than being able to remain friendly with the nation whose ship you just attacked.

I'm not 100% happy with the Nation Relation code just yet as there is still some confusing stuff cluttering things up.
For example, WHY would we need this 'AttackNation' function in the first place?
And why are we setting relations in some cases like this, but giving relation changes in other cases, such as sinking/capturing ships.

Then there is also the seeming difference between "nation relations" and "GOVERNOR relations". I don't think that is quite functional.
Neither is this "number of soldiers killed" counter that is supposed to do.... things.

Anyway, I think this is technically more functional than it was and at least not "broken".
So as far as I'm concerned, this will be good enough for the Beta 4 public release.
We can always do further clean up and finishing these things later. Rome wasn't built in a day.... :rolleyes:
 
  • Like
Reactions: jsv
And to make it more obvious when that happens, I'm adding the following code to be executed for ALL Ship's Log entries:
Code:
   // PB: Sound and on-screen effects -->
   Log_SetStringToLog(XI_ConvertString("Ship Log Update"));
   AddMsgToCharacter(pchar,MSGICON_LOGBOOK);
   PlaySound("INTERFACE\notebook_01.wav");
   // PB: Sound and on-screen effects <--

This sounds very nice. It's always good to inform the player of the game having such features, especially if they work well; they're surprisingly easy to miss.
 
Everything as per the opening post has been done. So unless I hear otherwise, I'm considering this done.
 
Back
Top