An immersive way to make some AI factions leave you alone.


The end result is that some of your suitors or even adoptees will trigger and maintain an unbreakable alliance with certain factions as long as they're alive.


First, create a trait that informs the player and allows scripting checks


Code:

;------------------------------------------


Trait MacedonOfficialOfSeleucid
    Characters family
	
	Level Macedon_Official_Of_Seleucid
        Description Macedon_Official_Of_Seleucid_desc
        EffectsDescription Macedon_Official_Of_Seleucid_effects_desc
        Threshold 1


        Effect Influence 2
		Effect Command -2
		Effect Management -2


;------------------------------------------
Trigger Makedonia_Makedon_Hypotropos_Seleucid_Official_Marry
  WhenToTest OfferedForMarriage


    Condition FactionType macedon
          and Trait MakedonianHypotropos > 0


  Affects MacedonOfficialOfSeleucid  1  Chance  100
  
 ;------------------------------------------
Trigger Makedonia_Makedon_Hypotropos_Seleucid_Official_adopt
  WhenToTest OfferedForAdoption


    Condition FactionType macedon
          and Trait MakedonianHypotropos > 0


  Affects MacedonOfficialOfSeleucid  1  Chance  100

In EB1 for which this feature was intended for, "Hypotropos"/"Returned Macedonian" is a potential ethnicity for suitors or adoptees. So we'll use that for a Macedonian-Seleucid marriage alliance. Maybe the Macedonian ingratiated himself with the Seleucid court before returning home. Anyways, give your adoptees a reasonable chance to have this trait. Too low and your players won't experience this mechanic. Too much and the player's family tree becomes polluted with alliance anchors. Why the big Influence and Command penalties? Well...


Code:

¬--------------------


{Macedon_Official_Of_Seleucid}	Seleucid Official


{Macedon_Official_Of_Seleucid_desc}
This man is holds great power in the Seleucid Empire, whether by being part of the Seleucid King's inner court as a "Philos", a trusted general, or even of noble blood - descendent of the legendary Seleucus I. By introducing him into the Antigonid court by marriage or adoption, we will have strengthened the bonds between the Antigonid Kingdom and the Seleucid Empire. This close alliance lives and dies with this man though, so either keep him alive at all costs, or suicide him if the situation demands it. Also, he comes across as somewhat incompetent, almost as if his sole value is being a pawn in the geopolitical game.


{Macedon_Official_Of_Seleucid_effects_desc}
+2 Influence, -2 Command, -2 Management, permanent alliance and nonaggression with the Seleucids. Don't like it? Suicide this guy

Balancing reasons. A character whose mere existence forces the omnicidal RTW AI to not attack the player should be nerfed in a reasonable way. Next, the campaign scripting.


Code:





;;; Seleucid Marriage Alliance


declare_counter macedon_has_seleucid_noble
declare_counter macedon_alliance_with_seleucids


monitor_event CharacterTurnStart FactionType macedon
	and CharacterIsLocal
	and Trait MacedonOfficialOfSeleucid = 1
	
	set_counter macedon_has_seleucid_noble 1
	
	if I_CompareCounter macedon_alliance_with_seleucids < 1
		message_prompt
		{
			flag_counter flag_prompt
			result_counter flag_prompt


			title Macedon_Alliance_With_Seleucids_Text_01_Title
			body Macedon_Alliance_With_Seleucids_Text_01_Text1


			image messenger
		}
	end_if
	set_counter macedon_alliance_with_seleucids 1
end_monitor


monitor_event FactionTurnStart FactionType macedon
	and FactionIsLocal
	and I_CompareCounter macedon_alliance_with_seleucids = 1
	and not DiplomaticStanceFromFaction romans_julii Allied
	
	console_command diplomatic_stance macedon romans_julii allied
	
	message_prompt
	{
		flag_counter flag_prompt
		result_counter flag_prompt


		title Macedon_Alliance_With_Seleucids_Ceasefire_Text_01_Title
		body Macedon_Alliance_With_Seleucids_Ceasefire_Text_01_Text1


		image messenger
	}
end_monitor


monitor_event FactionTurnEnd FactionType macedon
	and FactionIsLocal
	if I_CompareCounter macedon_has_seleucid_noble < 1
		set_counter macedon_alliance_with_seleucids 0
	end_if
	set_counter macedon_has_seleucid_noble 0
end_monitor

And that's it. If the player or AI breaks the alliance, then the script restores it before the player's turn begins. It's almost as if the backstab never happened. Likewise, ending this mechanic is as simple as ridding your family tree of all characters with the trigger trait.