This mechanic is unimpressive from a technical point of view, but is extremely fun and immersive for the player, and easy to implement for the modder. After all, what can be more fun than to fund proxy wars? Just spend a little money to spawn massive stacks in allied faction's cities, and send in your spies to allow you to spectate the carnage.


First, you need a way of triggering the funding of a proxy war. There is the diplomat way (recommended), and there is the building way (not recommended). For the diplomat way, it's as easy as a monitor that checks if one of your diplomats is near a city that for historical reasons is a prime target to fund insurgency.


Code:

declare_counter ptolemaioi_cyclades_count
set_counter ptolemaioi_cyclades_count 0


monitor_conditions I_FactionNearTile numidia 0  176, 152
	and I_LocalFaction numidia


	if I_CharacterTypeNearTile numidia family, 0  176, 152
		message_prompt
		{
			flag_counter flag_prompt
			result_counter flag_prompt


			title Ptolemaioi_Cyclades_Alliance_Text_01_Title
			body Ptolemaioi_Cyclades_Alliance_Text_01_Text1


			image messenger
		}
		
		;; IF accepted, spawn armies for the allied faction
		
		terminate_monitor
	end_if
	
end_monitor

This is recommended because it doesn't use up a building slot (other modders have reported that using too many of the "unlimited" building slots will cause minor bugs on the campaign map. The building trigger on the other hand requires an entire building tree for each proxy war you want to simulate. This is bad for mods that already have a ton of building trees, but has a few advantages, namely requiring building times to prevent the player from spamming proxy conflicts.


Code:



building ptolemaioi_proxy_anti_antigonid
{
    classification military
    icon law
    levels ptolemaioi_proxy_anti_antigonid
    {
		ptolemaioi_proxy_anti_antigonid requires factions { numidia, } and is_player and hidden_resource EA and hidden_resource E and hidden_resource y1 and hidden_resource n2 and hidden_resource n4 and hidden_resource n8		
		{
            capability
            {     
			
			}
            construction  1
            cost  5000
            settlement_min town
            upgrades
            {
			
            }
        }
    }
    plugins
    {
    }
}

Code:

; Anti-Antigonid


monitor_event SettlementTurnStart TrueCondition
	and SettlementName Alexandreia
	and SettlementBuildingExists = ptolemaioi_proxy_anti_antigonid
	
	destroy_building "Alexandreia" ptolemaioi_proxy_anti_antigonid
	
	inc_counter ptolemaioi_proxy_count 1
	
	
	if I_SettlementOwner Athenai = greek_cities
		console_command create_unit Athenai "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Athenai "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Athenai "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Athenai "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Athenai "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Athenai "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	if I_SettlementOwner Sparte = greek_cities
		console_command create_unit Sparte "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Sparte "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Sparte "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Sparte "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Sparte "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Sparte "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	
	if I_SettlementOwner Korinthos = greek_cities
		console_command create_unit Korinthos "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Korinthos "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Korinthos "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Korinthos "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Korinthos "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Korinthos "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	if I_SettlementOwner Thibai = greek_cities
		console_command create_unit Thibai "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Thibai "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Thibai "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Thibai "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Thibai "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Thibai "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	
	if I_SettlementOwner Thermon = greek_cities
		console_command create_unit Thermon "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Thermon "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Thermon "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Thermon "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Thermon "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Thermon "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	
	if I_SettlementOwner Chalkis = greek_cities
		console_command create_unit Chalkis "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Chalkis "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Chalkis "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Chalkis "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Chalkis "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Chalkis "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	
	
	if I_SettlementOwner Elis = greek_cities
		console_command create_unit Elis "hellenistic infantry hoplitai" 2 0 0 0
		console_command create_unit Elis "hellenistic infantry hoplitai merc" 2 0 0 0
		console_command create_unit Elis "greek infantry taxeis hoplitai" 4 0 0 0
		console_command create_unit Elis "greek skirmisher peltastai mercenary" 2 0 0 0
		console_command create_unit Elis "hellenistic missile cretan archers merc" 1 0 0 0
		console_command create_unit Elis "greek cavalry mistophoroi hippeis" 1 0 0 0
	end_if
	
	declare_counter turmoil     
	set_counter turmoil 9


	for_each settlement in faction "macedon"
		if SettlementName Sparte
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Korinthos
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Elis
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Athenai
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Chalkis
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Thibai
			
			store_counter turmoil settlement settlement_turmoil
		end_if
		
		if SettlementName Thermon
			
			store_counter turmoil settlement settlement_turmoil
		end_if
	end_for
end_monitor

The end result is that spending 5000 money makes the script spawn massive KH armies in southern greece and also "turmoil" (see my post about simulating M2TW-style temporary unrest) by checking for that building, destroying it, and then spawning the armies.


This is easy to implement, but extremely fun. A campaign is so much more entertaining when at the end of a long turn you move your spy over to where you're funding a proxy war and you watch the absolute carnage unfolding.