// STEP 2: Figure out what to do with them
Preprocessor_Add("nationnamei", XI_ConvertString(GetNationNameByType(i)));
Preprocessor_Add("nationnamej", XI_ConvertString(GetNationNameByType(j)));
Preprocessor_Add("nationdesci", XI_ConvertString(GetNationDescByType(i)));
Preprocessor_Add("nationdescj", XI_ConvertString(GetNationDescByType(j)));
Preprocessor_Add("nationtowni", XI_ConvertString(GetTownByNation(i)))
switch(GetNationRelation(i,j))
{
case RELATION_ENEMY:
logTitle = GetTranslatedLog("#snationnamei# and #snationnamej# make peace");
logEntry = GetTranslatedLog("After some time of bloody warfare #snationnamei# and #snationnamej# have declared a ceasefire.");
if(GetNationRelation2MainCharacter(i)==RELATION_FRIEND && GetNationRelation2MainCharacter(j)==RELATION_FRIEND) logEntry += " " + GetTranslatedLog("This is good news as it was a very hard time to keep friendly relations with two warfaring parties.");
if(IsInServiceOf(i) && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nAlthough good news in general, this is bad news for me. Attacking #snationdescj# ships and towns will not raise my reputation with the #snationdesci# anymore.");
if(IsInServiceOf(j) && GetNationRelation2MainCharacter(i)==RELATION_ENEMY) logEntry += "\n \nAlthough good news in general, this is bad news for me. Attacking #snationdesci# ships and towns will not raise my reputation with the #snationdescj# anymore.");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_NEUTRAL;
break;
case RELATION_NEUTRAL:
random = rand(2);
if(random==0)
{
logTitle = GetTranslatedLog("#snationnamei# and #snationnamej# have allied");
logEntry = GetTranslatedLog("#snationnamei# and #snationnamej# have formed an alliance. Attacking ships or towns of either nation will also decrease the standing with the ally.");
if(GetNationRelation2MainCharacter(i)==RELATION_FRIEND && GetNationRelation2MainCharacter(j)==RELATION_FRIEND) logEntry += " " + GetTranslatedLog("Very good news, indeed. Working for the #snationdesci# and the #snationdescj#, as I currently do, my deeds will raise my standing with both nations.");
if(GetNationRelation2MainCharacter(i)==RELATION_ENEMY && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += " " + GetTranslatedLog("Whoops! It seems I have bothered them a little too much. But their alliance won't stop me.");
if(IsInServiceOf(i) && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nThis makes working for the #snationdesci# somewhat more difficult, as sinking #snationdescj# ships is no longer an option.");
if(IsInServiceOf(j) && GetNationRelation2MainCharacter(i)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nThis makes working for the #snationdescj# somewhat more difficult, as sinking #snationdesci# ships is no longer an option.");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_FRIEND;
}
if(random==1) // i declared war on j
{
logTitle = GetTranslatedLog("#snationnamei# is at war with #snationnamej#");
logEntry = GetTranslatedLog("#snationnamei# has declared war on #snationnamej#. #snationdesci# ships have attacked a small #snationdescj# settlement, as I was told.");
if(IsInServiceOf(i) && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nIt was about time to show those #snationnamej# landlubbers who's in charge in the caribbean!");
if(IsInServiceOf(j) && GetNationRelation2MainCharacter(i)==RELATION_ENEMY) logEntry += GetTranslatedLog("Those bloody cowards! The next #snationnamei# ship we encounter will surely pay for this.");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_ENEMY;
}
if(random==2) // j declared war on i
{
logTitle = GetTranslatedLog("#snationnamej# is at war with #snationnamei#");
logEntry = GetTranslatedLog("#snationnamej# has declared war on #snationnamei#. #snationdescj# troops have landed near #snationtowni#, as I was told.");
if(IsInServiceOf(i) && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += GetTranslatedLog("Those bloody cowards! The next #snationnamej# ship we encounter will surely pay for this.");
if(IsInServiceOf(j) && GetNationRelation2MainCharacter(i)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nIt was about time to show those #snationnamei# landlubbers who's in charge in the caribbean!");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_ENEMY;
}
break;
case RELATION_FRIEND:
random = rand(2);
if(random==0)
{
logTitle = GetTranslatedLog("#snationnamei# and #snationnamej# broke their alliance");
logEntry = GetTranslatedLog("#snationnamei# and #snationnamej# have broken their alliance, but are currently peaceful. Observers report military activity on both sides, but so far an open conflict has been avoided.");
newRelation = RELATION_NEUTRAL;
}
if(random==1) // i broke the alliance
{
logTitle = GetTranslatedLog("#snationnamei# and #snationnamej# broke their alliance");
logEntry = GetTranslatedLog("#snationnamei# and #snationnamej# have broken their alliance and are now at war! It was reported that #snationnamei# broke the alliance by")+ " " +GetBreakAllianceReason(i,j);
if(IsInServiceOf(j) && GetNationRelation2MainCharacter(i)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nThose treacherous bastards! The #snationdesci# will pay for this betrayal. I have ordered to open fire on sight of any #snationdesci# ship.");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_NEUTRAL;
}
if(random==2) // j broke the alliance
{
logTitle = GetTranslatedLog("#snationnamej# and #snationnamei# broke their alliance");
logEntry = GetTranslatedLog("#snationnamej# and #snationnamei# have broken their alliance and are now at war! It was reported that #snationnamej# broke the alliance by")+ " " +GetBreakAllianceReason(j,i);
if(IsInServiceOf(i) && GetNationRelation2MainCharacter(j)==RELATION_ENEMY) logEntry += GetTranslatedLog("\n \nThose treacherous bastards! The #snationdescj# will pay for this betrayal. I have ordered to open fire on sight of any #snationdescj# ship.");
WriteNewLogEntry(PreprocessText(logTitle), PreprocessText(logEntry), "General",false);
newRelation = RELATION_ENEMY;
}
break;
Preprocessor_Delete("nationnamei");
Preprocessor_Delete("nationnamej");
Preprocessor_Delete("nationdesci");
Preprocessor_Delete("nationdescj");
Preprocessor_Delete("nationtowni");
}
// STEP 3: Change relation and match player if required
SetNationRelationBoth(i, j, newRelation);
if(ServedNation != PERSONAL_NATION) // For any player that serves a specific nation
{
if(i == ServedNation || j == ServedNation)
{
if(i == ServedNation) i = j; // Don't change your relation to your OWN nation
SetNationRelation2MainCharacter(i, newRelation);
}
}
// STEP 4: Notify the player that this happened the first time
if(!CheckAttribute(PChar, "changing_relations_note")) // PB: Add clarifying note
{
SetQuestHeader("changing_relations");
AddQuestRecord("changing_relations", "1");
CloseQuestHeader("changing_relations");
PChar.changing_relations_note = 1;
}
}
// PB: Rewritten to a maximum of one change per day <--
}
string GetBreakAllianceReason(int traitor, int victim)
{
int random;
Preprocessor_Add("nationdescv", XI_ConvertString(GetNationDescByType(victim)));
Preprocessor_Add("nationnamet", XI_ConvertString(GetNationNameByType(traitor)));
string sReasons[6];
sReasons[0] = XI_ConvertString("'accidently' sinking the #snationdescv# military supply convoy.");
sReasons[1] = XI_ConvertString("treating the #snationdescv# ambassador in a 'disrespectful' manner, as was reported from Europe.");
sReasons[2] = XI_ConvertString("brutally burning down a small settlement of the #snationdescv#, leaving no one alive (I am curious how they got this report then?).");
sReasons[3] = XI_ConvertString("officially knighting a notorious freebooter, who plundered the #snationdescv# colonies in the previous war.");
sReasons[4] = XI_ConvertString("inciting a slave revolt in a major #snationdescv# colony.");
sReasons[5] = XI_ConvertString("sending a horde of French squirrels with blond wigs to pillage a Spanish monastery.\n \n This doesn't make any sense at all and does not really explain why #snationnamet# broke their alliance, but that's what they did.");
random = rand(5);
return sReasons[random];
Preprocessor_Delete("nationdescv");
Preprocessor_Delete("nationnamet");