Results 1 to 9 of 9

Thread: Need hel;p with Ai modding..

  1. #1
    Senior Member Senior Member Carl's Avatar
    Join Date
    Dec 2006
    Posts
    1,461

    Default Need hel;p with Ai modding..

    I decided to had a go at improving the strategic AI by activating the trusted allies code and tinkering with a few things to improve garrisoning. Unfortunately the file won't work, I get unspecified error messages whenever i try to start a campaign with it. I know it's the AI as swapping the default file in cures it:

    Thus, could a more experienced moder look through it and point out my error/s for me.

    Code:
    <?xml version="1.0"?>
    <root>
    	<!--
    		<trusted_ally_fs_threshold float="0.8"/>			// min threshold for how much we like the target faction to consider them a trusted ally
    		<trusted_ally_target_fs_threshold float="0.8"/>		// min threshold for how much does the target faction like us to consider them a trusted ally
    		<trusted_ally_gs_threshold float="0.2"/>			// min threshold for how trustworthy is the target faction to consider them a trusted ally
    
    		<faction_ai_label name="default">	:: The label for a following set of campaign ai faction parameters
    		
    		<invasion_decisions>				:: List of ai invasion decisions. when choosing a decision, code will iterate from first to last until a set of thresholds succeeds
    		
    			<decision_entry>				:: An individual decision entry
    			
    				<min_entry											:: The minimum threshold for decision comparison
    							frontline_balance="0.0"					:: ratio of factions frontline military strength vs the target
    							military_balance="0.0"					:: ratio of factions overall military strength vs the target
    							production_balance="0.0"				:: ratio of factions overall production strength vs the target
    							target_num_enemies="0"					:: the number of enemies the target has
    							num_enemies="0"							:: the number of enemies the faction has
    							has_alliance_against="false"			:: is the faction part of an alliance against target
    							military_balance_plus_enemies="0.0"		:: ratio of factions overall military strength vs the target (plus all of its enemies)
    							alliance_military_balance="0.0"			:: ratio of factions (plus its allies) overall military strength vs the target
    							strongest_neighbour="false"				:: is the target the factions strongest neighbour
    							most_desirable="false"					:: is the traget the factions most desirable target
    							faction_standing="-1.0"					:: how much does the faction like the target
    							target_global_standing="-1.0"			:: how trustworthy is the target to the rest of the world
    							target_faction_standing="-1.0"			:: how much does the target faction like this faction
    							global_standing="-1.0"					:: how trustworthy is this faction to the rest of the world
    							target_religion="catholic"				:: the religion of the target (see descr_religions.txt)
    							enemy_excommunicated="false"			:: is the target excommunicated
    							num_turns_allied="0"					:: the number of turns since the faction agreed to an alliance with the target
    							num_turns_ceasfire="0"					:: the number of turns since the faction has agreed to a ceasefire with the target (-1 for no agreement)
    							stance="Allied"							:: diplomatic stance with the target (Allied, Neutral, AtWar)
    							target_faction="england"				:: target faction label (see descr_sm_factions.txt)
    							target_human="false"					:: is the target a human player
    							target_is_shadow="false"/>				:: is the target this factions shadow faction
    							turn_number="0"							:: the game turn number (starting at 0)
    							is_protectorate="false"					:: is the target our protectorate
    							is_protectorate_of_catholic="false"		:: is the target a protectorate of a non-excommunicated catholic faction
    							free_strength_balance="0.0"				:: ratio of factions free military strength vs the target
    							borders_all_our_regions="false"			:: does the target border on all the factions region groups
    							target_weakest_neighbour="false"		:: is the faction the targets weakest neighbour
    							has_ceasehostilities="false"			:: does the faction have a cease hostilities mission against the target from the papal faction
    							is_neighbour="false"					:: does the target neighbour on any of the factions regions
    							trusted_ally="false"					:: is the target a trusted ally (they like us more than fs_thresh, and their global standing > gs_thresh, and they are allied)
    							trusted_ally_enemy="false"				:: is the target an enemy of a trusted ally
    							trusted_ally_protectorate="false"		:: is the target a protectorate of a trusted ally
    							num_settlements="0"						:: how many settlements does the faction own
    							
    				<max_entry											:: The maximum threshold for decision comparison
    							frontline_balance="999.0"
    							military_balance="999.0"
    							production_balance="999.0"
    							target_num_enemies="999"
    							num_enemies="999"
    							has_alliance_against="true"
    							military_balance_plus_enemies="999.0"
    							alliance_military_balance="999.0"
    							strongest_neighbour="true"
    							most_desirable="true"
    							faction_standing="1.0"
    							target_global_standing="1.0"
    							target_faction_standing="1.0"
    							global_standing="1.0"
    							target_religion="heretic"
    							enemy_excommunicated="true"
    							num_turns_allied="999"
    							num_turns_ceasfire="999"
    							stance="AtWar"
    							target_faction="slave"
    							target_human="true"
    							target_is_shadow="true"/>
    							is_protectorate="true"
    							is_protectorate_of_catholic="true"
    							free_strength_balance="999.0"
    							borders_all_our_regions="true"
    							target_weakest_neighbour="true"
    							has_ceasehostilities="true"
    							is_neighbour="true"
    							trusted_ally="true"
    							trusted_ally_enemy="true"
    							trusted_ally_protectorate="true"
    							num_settlements="999"
    							
    				<faction_attitude									:: A list of modifiers to apply if min and max entries above are successful
    									defense="defend_normal"			:: The long term defense type (defend_minimal, defend_normal, defend_raid, defend_frontline, defend_fortified, defend_deep)
    									defend_priority="0"				:: The defensive priority of achieving stance against this faction (NOT USED AT PRESENT)
    									invade="invade_none"			:: The long term invade type (invade_buildup, invade_immediate, invade_raids, invade_opportunistic, invade_start, invade_none)
    									invade_priority="0"				:: priority of achieving invasion against this faction
    									at_war="false"					:: are we at war with this enemy
    									want_peace="false"				:: do we want to be at peace with this faction
    									want_ally="false"				:: do we want to ally with this faction
    									want_be_protect="false"			:: do we want to be a protectorate of this faction
    									want_offer_protect="false"		:: do we want to offer protectorate status to this nation
    									force_invade="false"			:: must we invade now
    									alliance_against="0"			:: how much do we want to have an alliance against this nation
    									pts_desire="0"					:: points total for measuring our desire for this faction's territory
    									pts_alliance="0"				:: points total for measuring how much we want to be allies with these people
    									can_force_invade="true"			:: can naval or forced invasion settings overwrite invade parameters
    			</decision_entry>
    			
    		</invasion_decisions>
    			
    		<defend_decisions>				:: List of ai defend decisions. when choosing a decision, code will iterate from first to last until a set of thresholds succeeds (uses identical data to invasion decisions)
    			
    		</defend_decisions>
    
        -->
        
        
    	<!--
    	NEW PARAMETERS TO CREATE AND USE:
    	papal_standing			:: our standing with the papal states
    	target_papal_standing	:: targets standing with the papal states
    	rand					:: a random number
    	excommunicated			:: is this faction excommunicated
    	target_difficulty			:: what campaign difficulty has the target chosen
    	-->
    
    
    
    	<!--
    	///////////////////////////////////////////////////////////
    	// GLOBAL AI PARAMS (currently disabled, i.e. range = [-1.0, 1.0]) //
    	///////////////////////////////////////////////////////////
    	-->
    
    	<trusted_ally_fs_threshold float="0.75"/>
    	<trusted_ally_target_fs_threshold float="0.75"/>
    	<trusted_ally_gs_threshold float="0.1"/>
    	
    	
    	<!--
    	///////////////////////////////////////
    	// DEFAULT AI PARAMS.  DO NOT REMOVE //
    	///////////////////////////////////////
    	-->
    
    	<faction_ai_label name="default">
    	
    		<invasion_decisions>
    
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					If trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally="true"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade
    				-->
    				<max_entry	num_turns_allied<="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a short time ago, no invasion set up, cannot force invade
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire<="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are our protectorate, use defaults
    				-->
    				<min_entry	is_protectorate="true"/>
    				<max_entry	is_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, use defaults, may be overridden by forced/naval attacks
    				-->
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	turn_number="30" target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="1200"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we've more than twice his frontline strength, then >>> invade immediate
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"  is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we're superior on the frontline,	then >>> invade buildup
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0" is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="800"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're not at war and it is very early in the game, do not invade (grabbing rebel regions instead)
    				-->
    				<max_entry	stance="Neutral" turn_number<="10"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> propose he become vassal, invade immediate.  If not our shadow, also want to offer protectorate
    				-->
    					<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> propose he become vassal, invade immediate.  If our shadow, do not want to offer protectorate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" target_num_enemies="3"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="750"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="700"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="650"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="600" alliance_against="10"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="550" alliance_against="8"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="500"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	num_enemies="2" frontline_balance="3.0" military_balance_plus_enemies="1.0"/>
    				<max_entry	num_enemies="2"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="450"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="400"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="350" alliance_against="2"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="300"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="1" production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="250" alliance_against="6"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="200" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="150" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: invade_none
    				-->
    			</decision_entry>
    			
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns)
    			</decision_entry>
    			-->
    			
    		</invasion_decisions>
    		
    		
    		<defend_decisions>
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS.  CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we have any settlements, and we are at the very start of the game, and target is not human (cannot trust humans) >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" turn_number="10" target_human="false"/>
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at the start of the game >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" is_neighbour="false" turn_number="30"/>
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at war, and they are not a trusted allies enemy, use defaults + want peace
    				-->
    				<min_entry	num_settlements="1" stance="AtWar" />
    				<max_entry	is_neighbour="false" trusted_ally_enemy="false"/>
    				<faction_attitude	want_peace="true" can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, use defaults
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	is_neighbour="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" want_be_protect="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours >>> 
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" want_be_protect="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true" target_is_shadow="false"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> conduct raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	defense="defend_raid" alliance_against="4"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war, and none of the previous rules apply,
    					then >>> frontline defense
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> deep defense
    				-->
    				<min_entry	free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && we are allied to him,
    					then >>> minimal defense
    				-->
    				<max_entry	target_weakest_neighbour="false" stance="Allied"/>
    				<faction_attitude	defense="defend_frontline"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> frontline defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="1" num_enemies="1"/>
    				<faction_attitude	defense="defend_frontline"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> normal defense
    				-->
    				<max_entry	target_num_enemies="1" num_enemies="1"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: defend minimal
    				-->
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    	</faction_ai_label>
    	
    
    	<!--
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	// PAPAL FACTION AI PARAMS.  REQUIRES SPECIAL STUFF TO NOT ALLOW ATTACKING NON-EXCOMMUNICATED CATHOLIC FACTIONS //
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="papal_faction">
    	
    		<invasion_decisions>
    
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					If trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally="true"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if target is a non-excommunicated catholic faction, no invasion set up, cannot force invade
    				-->
    				<min_entry	target_religion="catholic"/>
    				<max_entry	target_religion="catholic" enemy_excommunicated="false"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade
    				-->
    				<max_entry	num_turns_allied<="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a short time ago, no invasion set up, cannot force invade
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire<="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are our protectorate, use defaults
    				-->
    				<min_entry	is_protectorate="true"/>
    				<max_entry	is_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					If they are a protectorate of a catholic faction, use defaults
    				-->
    				<min_entry	is_protectorate_of_catholic="true"/>
    				<max_entry	is_protectorate_of_catholic="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, use defaults, may be overridden by forced/naval attacks
    				-->
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	turn_number="30" target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="1200"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we've more than twice his frontline strength, then >>> invade immediate
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"  is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we're superior on the frontline,	then >>> invade buildup
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0" is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="850"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're not at war and it is very early in the game, do not invade (grabbing rebel regions instead)
    				-->
    				<max_entry	stance="Neutral" turn_number<="10"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if target is catholic faction we are not at war with, no invasion set up
    				-->
    				<min_entry	target_religion="catholic"/>
    				<max_entry	target_religion="catholic" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> propose he become vassal, invade immediate.  If not our shadow, also want to offer protectorate
    				-->
    					<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> propose he become vassal, invade immediate.  If our shadow, do not want to offer protectorate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" target_num_enemies="3"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="750"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="700"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="650"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="600" alliance_against="10"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="550" alliance_against="8"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="500"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	num_enemies="2" frontline_balance="3.0" military_balance_plus_enemies="1.0"/>
    				<max_entry	num_enemies="2"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="450"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="400"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="350" alliance_against="2"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="300"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="1" production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="250" alliance_against="6"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="200" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="150" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: invade_none
    				-->
    			</decision_entry>
    			
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns)
    			</decision_entry>
    			-->
    			
    		</invasion_decisions>
    		
    		
    		<defend_decisions>
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS.  CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					if we have any settlements, and we are at the very start of the game, and target is not human (cannot trust humans) >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" turn_number="10" target_human="false"/>
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at the start of the game >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" is_neighbour="false" turn_number="30"/>
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if target is non-excommunicated catholic faction, and they don't mind us much, and they are not obviously untrustworthy, minimal defense required
    				-->
    				<min_entry	target_religion="catholic" target_faction_standing="-0.1" target_global_standing="-0.1"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false"/>
    				<faction_attitude	defense="defend_frontline"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at war, and they are not a trusted allies enemy, use defaults + want peace
    				-->
    				<min_entry	num_settlements>="1" stance="AtWar" />
    				<max_entry	is_neighbour="false" trusted_ally_enemy="false"/>
    				<faction_attitude	want_peace="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, use defaults
    				-->
    				<min_entry	num_settlements>="1"/>
    				<max_entry	is_neighbour="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" want_be_protect="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" want_be_protect="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true" target_is_shadow="false"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> conduct raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	defense="defend_raid" alliance_against="4"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war, and none of the previous rules apply,
    					then >>> frontline defense
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> deep defense
    				-->
    				<min_entry	free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && we are allied to him,
    					then >>> minimal defense
    				-->
    				<max_entry	target_weakest_neighbour="false" stance="Allied"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> frontline defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="2" num_enemies="1"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> normal defense
    				-->
    				<max_entry	target_num_enemies="1" num_enemies="1"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: defend minimal
    				-->
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    	</faction_ai_label>
    	
    
    	<!--
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	// CATHOLIC FACTION AI PARAMS.  REQUIRES SPECIAL STUFF TO REDUCE ATTACKING NON-EXCOMMUNICATED CATHOLIC FACTIONS //
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="catholic">
    	
    		<invasion_decisions>
    
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					If trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally="true"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade
    				-->
    				<max_entry	num_turns_allied<="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a short time ago, no invasion set up, cannot force invade
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire<="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are our protectorate, use defaults
    				-->
    				<min_entry	is_protectorate="true"/>
    				<max_entry	is_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					If they are the papal states and they like us, use defaults
    					(using their FS instead of ours, else it may not fire since papal states does not try to upset catholics)
    				-->
    				<min_entry	target_faction="papal_states" target_faction_standing="-0.5"/>
    				<max_entry	target_faction="papal_states"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					If we have a cease hostilities mission against the target, and we like them above a threshold, and our global standing is reasonable, use defaults
    					(this will stop factions from attacking some targets if it will cause excommunication)
    				-->
    				<min_entry	has_ceasehostilities="true" enemy_excommunicated="false"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, use defaults, may be overridden by forced/naval attacks
    				-->
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	can_force_invade="false"/>			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	turn_number="30" target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="1200"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we've more than twice his frontline strength, then >>> invade immediate
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"  is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we're superior on the frontline,	then >>> invade buildup
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0" is_neighbour="true"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="850"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="850"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're not at war and it is very early in the game, do not invade (grabbing rebel regions instead)
    				-->
    				<max_entry	stance="Neutral" turn_number<="10"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> propose he become vassal, invade immediate.  If not our shadow, also want to offer protectorate
    				-->
    					<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> propose he become vassal, invade immediate.  If our shadow, do not want to offer protectorate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" target_num_enemies="3"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="750"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="700"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="650"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="600" alliance_against="10"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="550" alliance_against="8"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="500"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	num_enemies="2" frontline_balance="3.0" military_balance_plus_enemies="1.0"/>
    				<max_entry	num_enemies="2"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="450"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="400"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="350" alliance_against="2"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="300"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="1" production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="250" alliance_against="6"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="200" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_start" invade_priority="150" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: invade_none
    				-->
    			</decision_entry>
    			
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns)
    			</decision_entry>
    			-->
    			
    		</invasion_decisions>
    		
    		
    		<defend_decisions>
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS.  CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					if we have any settlements, and we are at the very start of the game, and target is not human (cannot trust humans) >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" turn_number<="10" target_human="false"/>
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at the start of the game >>> minimal defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	stance="Neutral" is_neighbour="false" turn_number="30" />
    				<faction_attitude	defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if target is non-excommunicated catholic faction, and they don't mind us much, and they are not obviously untrustworthy, minimal defense required
    				-->
    				<min_entry	target_religion="catholic" target_faction_standing="-0.1" target_global_standing="-0.1"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					otherwise if target is non-excommunicated catholic faction, normal defense required
    				-->
    				<min_entry	target_religion="catholic"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" defense="defend_minimal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at war, and they are not a trusted allies enemy, use defaults + want peace
    				-->
    				<min_entry	num_settlements="1" stance="AtWar" />
    				<max_entry	is_neighbour="false" trusted_ally_enemy="false"/>
    				<faction_attitude	want_peace="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, use defaults
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	is_neighbour="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" want_be_protect="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" want_be_protect="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true" target_is_shadow="false"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" want_peace="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" want_peace="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> conduct raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	defense="defend_raid" alliance_against="4"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war, and none of the previous rules apply,
    					then >>> frontline defense
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> deep defense
    				-->
    				<min_entry	free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && we are allied to him,
    					then >>> minimal defense
    				-->
    				<max_entry	target_weakest_neighbour="false" stance="Allied"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> frontline defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="1" num_enemies="1"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> normal defense
    				-->
    				<max_entry	target_num_enemies="1" num_enemies="1"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: defend minimal
    				-->
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    	</faction_ai_label>
    	
    
    	
    
    	<!--
    	/////////////////////////////////////////////////////////////
    	// SLAVE FACTION AI PARAMS.  THEY DON'T REALLY DO ANYTHING //
    	/////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="slave_faction">
    	
    		<invasion_decisions>
    
    			<decision_entry>
    				<!--
    					Just use defaults
    				-->
    			</decision_entry>
    
    		</invasion_decisions>
    		
    		
    		<defend_decisions>
    		
    			<decision_entry>
    				<!--
    					Always try and defend the settlements
    				-->
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    	</faction_ai_label>
    	
    
    	<!--
    	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	// MAPPING OF OLD ROME AI PARAMS.  NOTE THAT THE SPECIAL CASES AT THE START AND END STILL EXIST FOR ALL OTHER LABELS, BUT ARE NOT LISTED FOR SPACE REASONS //
    	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="rome">
    	
    		<invasion_decisions>
    
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR TRUSTED ALLIES, NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR PROTECTORATES, NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR PROTECTORATES OF TRUSTED ALLIES, NO INVASION IF SO
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, use defaults, may be overridden by forced attacks
    				-->
    				<min_entry	is_neighbour="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	turn_number>="30" target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="1000"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="850"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> propose he become vassal, invade immediate.  If not our shadow, also want to offer protectorate
    				-->
    					<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> propose he become vassal, invade immediate.  If our shadow, do not want to offer protectorate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="800" want_offer_protect="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="750"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="700"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="650"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="600" alliance_against="10"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="550" alliance_against="8"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="500"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	num_enemies="1" frontline_balance="3.0" military_balance_plus_enemies="1.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="450"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="400"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="350" alliance_against="2"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="300"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="1"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_raids" invade_priority="250" alliance_against="6"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_start" invade_priority="200" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_start" invade_priority="150" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					THIS ONE PROBABLY WON'T GET FIRED SINCE IT USES THE SAME CHECK AS THE ONE TWO ENTRIES ABOVE!!!!
    					if we're not at war && we're not at war with anyone else && we outproduce him && he has highest invasion 
    					pts, then >>> plan future invasion
    				-->
    				<min_entry	num_enemies="0" production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_start" invade_priority="100" alliance_against="1"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: invade_none
    				-->
    			</decision_entry>
    			
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns)
    			</decision_entry>
    			-->
    			
    		</invasion_decisions>
    		
    		
    		<defend_decisions>
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR SETTING at_war AND want_peace FOR FACTIONS THAT ARE NOT OUR NEIGHBOURS
    			</decision_entry>
    			-->
    		
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS.  CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
    			</decision_entry>
    			-->
    		
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" defense="defend_normal" defend_priority="300"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="900" want_peace="true" want_be_protect="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours >>> propose become protectorate
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.25" production_balance="0.2"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="900" want_peace="false" want_be_protect="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true" target_is_shadow="false"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="850" want_peace="true" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours >>> deep defense, sue for peace
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="850" want_peace="false" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="800" alliance_against="7"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> conduct raids
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	defense="defend_raid" defend_priority="750" alliance_against="4"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war, and none of the previous rules apply,
    					then >>> frontline defense
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="700"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> deep defense
    				-->
    				<min_entry	free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="650"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified" defend_priority="600"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && we are allied to him,
    					then >>> minimal defense
    				-->
    				<max_entry	target_weakest_neighbour="false" stance="Allied"/>
    				<faction_attitude	defense="defend_minimal" defend_priority="550"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> frontline defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	defense="defend_frontline" defend_priority="500"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> normal defense
    				-->
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	defense="defend_normal" defend_priority="450"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DEFAULT: defend minimal
    				-->
    				<faction_attitude	defense="defend_minimal" defend_priority="400"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    	</faction_ai_label>
    	
    </root>
    Many Thanks.

    Carl.
    Last edited by Carl; 02-07-2007 at 22:52.
    Find my ProblemFixer Purehere.

    This ProblemFixer fixes the following: 2-Hander bug, Pike Bug, Shield Bug, Chasing Routers, Cav not Charging, Formation Keeping Improved, Trait Bugs, and Ancillary Bugs.

    BETA Testers needed for the current version of RebuildProblemFixer. Thread here

  2. #2
    Clan Takiyama Senior Member R'as al Ghul's Avatar
    Join Date
    Jan 2003
    Location
    ignores routers who aren't elite
    Posts
    2,554

    Default Re: Need hel;p with Ai modding..

    Sorry, am short on time.
    Look for a freeware program called "beyond compare" and make a check of the edited file against the vanilla file. The program will point out all differences.

    Singleplayer: Download beta_8
    Multiplayer: Download beta_5.All.in.1
    I'll build a mountain of corpses - Ogami Itto, Lone Wolf & Cub
    Sometimes standing up for your friends means killing a whole lot of people - Sin City, by Frank Miller

  3. #3
    Senior Member Senior Member Carl's Avatar
    Join Date
    Dec 2006
    Posts
    1,461

    Default Re: Need hel;p with Ai modding..

    Thanks, that would make it easier for people to help me as it's a damm big file and a bit difficult to remeber every single change I made.

    Should look on here or via googl;e?

    (i'll start on the forums ATM).
    Find my ProblemFixer Purehere.

    This ProblemFixer fixes the following: 2-Hander bug, Pike Bug, Shield Bug, Chasing Routers, Cav not Charging, Formation Keeping Improved, Trait Bugs, and Ancillary Bugs.

    BETA Testers needed for the current version of RebuildProblemFixer. Thread here

  4. #4
    Senior Member Senior Member Carl's Avatar
    Join Date
    Dec 2006
    Posts
    1,461

    Default Re: Need hel;p with Ai modding..

    I've edited my first post, the Code now has all changes Highlighted out in bold.

    Thanks R'as al Ghul for that program.

    All right, can anyone help now please?

    Thanks.

    Carl.
    Find my ProblemFixer Purehere.

    This ProblemFixer fixes the following: 2-Hander bug, Pike Bug, Shield Bug, Chasing Routers, Cav not Charging, Formation Keeping Improved, Trait Bugs, and Ancillary Bugs.

    BETA Testers needed for the current version of RebuildProblemFixer. Thread here

  5. #5
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: Need hel;p with Ai modding..

    Perhaps it doesn't like that you added max_entry or min_entry lines to decisions that only involve boolean (true or false) variables. If the minimum condition required is that something be true... then a max condition is not necessary, as true is the top of the line for that variable, and it could only otherwise be false which would not fill the min condition. That's the first thing I would remove, as it's possible the game doesn't like that you did it. Min and max conditions are optional, and redundant ones are just plain silly


    See my Sig+ below! (Don't see it? Get info here)

  6. #6
    Senior Member Senior Member Carl's Avatar
    Join Date
    Dec 2006
    Posts
    1,461

    Default Re: Need hel;p with Ai modding..

    Thanks for that Foz, I didn't realise they where redundent, so I figured those triggers maybe wern't working right and thus the engine was ignoring them. Thus resulting in them not being used...

    p.s. some of the stuff didn't highlight properly, but i've added in the < and > than signs on many turn based triggers as they appeared to be missing, have I added thosse correctly?
    Find my ProblemFixer Purehere.

    This ProblemFixer fixes the following: 2-Hander bug, Pike Bug, Shield Bug, Chasing Routers, Cav not Charging, Formation Keeping Improved, Trait Bugs, and Ancillary Bugs.

    BETA Testers needed for the current version of RebuildProblemFixer. Thread here

  7. #7
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: Need hel;p with Ai modding..

    Quote Originally Posted by Carl
    Thanks for that Foz, I didn't realise they where redundent, so I figured those triggers maybe wern't working right and thus the engine was ignoring them. Thus resulting in them not being used...

    p.s. some of the stuff didn't highlight properly, but i've added in the < and > than signs on many turn based triggers as they appeared to be missing, have I added thosse correctly?
    LOL. Nope. I'd have pointed it out if they were bold, but as it was I didn't see that at all. The point of max and min entries is that you don't have to use any logic except equals then. For instance take the following trigger (first I saw that you changed the logic sign in):

    Code:
    			<decision_entry>
    				<!--
    					If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade
    				-->
    				<max_entry	num_turns_allied<="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    min_entry always represents the minimum needed for it to apply, while max_entry is the maximum allowable for it to apply. In this case, we want to only use the trigger if we've been allied 3 or less turns. Thus the maximum allowable case is 3 turns, so we set:

    <max_entry num_turns_allied="3" stance="Allied"/>

    This tells the game that 3 is the maximum allowed value of num_turns_allied for the trigger to still apply - all lower values are assumed to also apply unless a minimum is specified in the min_entry. So the reason = is used everywhere is because min_entry and max_entry already imply >= and <= respectively. All we have to do is set the boundary values - i.e. the "equal" part of the <= or >=.


    See my Sig+ below! (Don't see it? Get info here)

  8. #8
    Senior Member Senior Member Carl's Avatar
    Join Date
    Dec 2006
    Posts
    1,461

    Default Re: Need hel;p with Ai modding..

    Thanks Foz , I suspect they are the problem here. I've never done any AI coding here so i never figured that bit out, thanks for the explanation. I DID try to highlight them, but they didn't highlight for some reason.

    Thanks Again.

    Carl.
    Find my ProblemFixer Purehere.

    This ProblemFixer fixes the following: 2-Hander bug, Pike Bug, Shield Bug, Chasing Routers, Cav not Charging, Formation Keeping Improved, Trait Bugs, and Ancillary Bugs.

    BETA Testers needed for the current version of RebuildProblemFixer. Thread here

  9. #9
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: Need hel;p with Ai modding..

    No problem Carl, happy to help as always.


    See my Sig+ below! (Don't see it? Get info here)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO