Page 3 of 3 FirstFirst 123
Results 61 to 85 of 85

Thread: Campaign/Diplomacy AI

  1. #61

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by CavalryCmdr
    Personally I'm still having trouble with Sicily getting 'stuck' on Tunis if the Moors get it first Sicily will usually just sit there until thier entire starting force goes rebel, and by then even hard level AI is so far in debt it cant do anything for a very long time. However if they dont get stuck, or the Moors dont get Tunis first, Sicily spreads like a deamon. One thing I've done that helps them (and Russia and Scotland, most factions that have the tendency to get 'stuck' early actually) is have a lower invade priority for the first 3 or 4 turns, then boost it up.
    Noticed the same thing and can happen with sicily over durazzo too. I'm thinking it is a side-effect of forced invasions maybe? If they're assigned a target this way and then don't take it they seem to lose their way completely.

    As a side-note to the second part the AI does seem to be more *efficiently* aggressive sometimes when they're a bit less aggressive overall. I've been thinking of having some early game mini-profiles for specific factions which get switched to the main one after x turns. On the other hand i've been thinking of giving factions like egypt, which have no neighbours and lots of rebels, an early game mini-profile which is extra-aggressive towards rebels. W


    Quote Originally Posted by CavalryCmdr
    With the settings I'm currently using the AI defends the frontline (defend_fortified) unless...
    Will defo try those out.

    Currently going backwards to try and nail down some actual numbers and using a stripped-down testing mini-profile where it is easy to change all the settings. I tried the invade_oppurtunistic idea but very weird things happened so i thought it was time to stop editing my main profile and write this instead as otherwise i'm probaly getting wrong results through typos etc.

    I want to see if i can pry out some approximate numbers relating to the offsets and also to distance at least.

    Code:
    <faction_ai_label name="testing">
    	
    <defend_decisions>
    
    <decision_entry>
    <min_entry	target_faction="slave" is_neighbour="true"/>
    <max_entry	target_faction="slave"/>
    <faction_attitude	at_war="true" defense="defend_minimal"/>
    </decision_entry>
    
    <decision_entry>
    <min_entry	target_faction="slave"/>
    <max_entry	target_faction="slave"/>
    <faction_attitude	at_war="true" defense="defend_minimal"/>
    </decision_entry>
    
    <decision_entry>
    <min_entry	is_neighbour="true"/>
    <faction_attitude	 defense="defend_deep"/>
    </decision_entry>
    
    <decision_entry>
    <faction_attitude	defense="defend_minimal"/>
    </decision_entry>
    
    </defend_decisions>
    
    
    <invasion_decisions>
    
    <decision_entry>
    <min_entry	target_faction="slave" is_neighbour="true"/>
    <max_entry	target_faction="slave"/>
    <faction_attitude	invade="invade_buildup" invade_priority="820"/>
    </decision_entry>
    
    <decision_entry>
    <min_entry	target_faction="slave"/>
    <max_entry	target_faction="slave"/>
    <faction_attitude	invade="invade_buildup" invade_priority="800"/>
    </decision_entry>
    
    
    <decision_entry>
    <min_entry	is_neighbour="true"/>
    <faction_attitude	invade="invade_none" can_force_invade="false"/>
    </decision_entry>
    		
    <decision_entry>
    <faction_attitude	invade="invade_none" can_force_invade="false"/>
    </decision_entry>
    			
    </invasion_decisions>
    		
    		
    </faction_ai_label>

    Quote Originally Posted by CavalryCmdr
    I've never tried has_cease_hostilities, it may work. Honestly I've not specifically tested has_ceasehostilities, but I have done numerous math tests on invade priority (which is affected by has_ceasehostilities) and they always work out numerically according to the LTGD log's invade priority.
    I will specifically test both shortly.
    I'll have to re-test it. Quite possible I've made a mistake.

    Speaking of which one of my previous "seems to be" theories wasn't right. Having all the defend settings the same e.g defend_deep doesn't make them merge more. Just a side-effect of me mainly watching one faction at a time when testing. Factions with roughly circular terriotories centred on their capital can be made to merge almost 100% but it's more a function of the basic geometry it seems.


    Quote Originally Posted by CavalryCmdr
    This all fits in with my experiences, on #4, the AI will definately attack multiple targets if the invade_priority for each is within a cirtain range, that range depending on the precived strength of the considering faction.

    Diferent regions priorities with the base being the invade priority for the target faction is easily seen in the LTGD with naval invasions your given the final invade priority for the individual target settlements. I have a list of what province is what number for the vanilla map somewhere, I'll see if I can find it if anyone wants it.
    Glad you mentioned that. I noticed those priorities being adjusted when i skimmed the log but i hadn't thought about using them to give me a baseline for the sort of number ranges the game is using. I could use a set of them to help figure it out. I'd definitely find a list of region id's useful if it's easy to paste here.

    Currently it's looking like the ranges are quite small, (need to test a lot more specifically to be sure), but drops in 10s or 20s seem enough to significantly alter the distance the AI will mount naval landings.

    Apart from anything else it does I'm thinking the invade priority acts as a kind of "desire filter" so, if the numbers being used by the game to decide the final invade priority are quite small, then too wide a variation in the set of invade_priorities in the AI file may end up having too exaggerated an effect i.e too aggressive or too passive.

    Will see. I'm going to pick some test cities and use my simplified profile and try and nudge the invade priority up and down until i get roughly the number that is the minimum for a faction to attack then try and change settings to see if i can get some rough numbers. Will probably try a naval landing one as i can use the priority offsets in the log file as clues.
    Last edited by nikolai1962; 12-02-2007 at 11:29.
    It's not a map.

  2. #62

    Default Re: Campaign/Diplomacy AI

    Example of what i mean about having early game mini-profiles.

    On my map Hungary has the first, uncontested shot, at Iasi and Bucharest but they always go for Zabgreb and Belgrad, I assume because of the gold mines, which are heavily contested by both Venice and HRE. So they often lose there plus, while they were fighting there, the byzies sneak in and grab Iasi and Bucharest leaving Hungary very weak.

    If i have the base invade priority much higher Hungary seems less choosy and goes for Iasi and Bucharest and ends up (on average) in a better position long-term vis a vis the byzies. Trouble is having the base invade priorities too high makes the AI ignore their defences. So you get situations like Hungary continuing to expand into russia even though their core cities are being taken by the byzies.

    May be possible with all the right settings to prevent this sort of thing generally but if not a mini-profile just for Hungary with a higher invade setting vs rebels that gets switched to the main profile after the first few turns might work. Somehow manipulating the percieved value of a region would work too but i'd want something that only tricked the AI into thinking a region was more valuable than it was as i don't want gold mines everywhere :)

    There's a few factions like that which could possibly do with slightly different decisions early on. Denmark on mine needs quite a high invade priority to bother with the scandinavian regions and is currently determining the minimum invade priority i need for the whole map. That's another case where if i figured out something separate for denmark i could reduce the baseline invade priority for my defensive AI.

    ~~~

    Typing the above jus made me realise something. I have my base invade priority set at the point where the least wanted city (Oslo) is *just* attacked. Denmark often loses these attacks because they send really tiny armies to get it. Just dawned on me (possibly obvious to everyone else) that the final invade priority may well influence the size of army the AI sends. Not so much at the beginning of the game when they attack with stacks you have set up in the strat file but after the first wave of rebel targets when their armies have been fragmented a bit by casualties, garrisons, new recruitment etc.

    Relates to another problem i have with the early expansion on my map. I split zagreb into three regions. Two of the three have gold mines, the actual Zagreb doesn't. I've had endless problems getting venice to expand properly because however i set up their start armies they always reshuffled them into two armies--a huge one for taking one of the goldmine regions and a tiny one for zagreb. The more starting units i gave them just increased the size of the goldmine army leaving the zagreb one the same size. The AI always making the zagreb army just the right size to consistently *fail* to take zagreb. Obvious now i see it.

    So thats another factor to take into account maybe. The final invade priority affecting AI army size.
    Last edited by nikolai1962; 12-02-2007 at 12:10.
    It's not a map.

  3. #63
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Campaign/Diplomacy AI

    Sorry I didn't explain my problem properly (was a bit tired )

    The actual problem is this: Sicily in II is much, much bigger than in vanilla, therefore it has 8 regions (may be 9, not quite sure). Not all of these belong to the Sicilian Emirates at the start. So I want them to try and take a few of the settlements, but they just seem to sit there like a duck. This doesn't seem to have anything to do with naval invasions as they didn't even plan any.

    What's even weirder is that I think it worked with the vanilla profile, so maybe I'll just have to investigate a bit more.

  4. #64
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    Thanks for all the info nikolai/CavalryCmdr, i'm going to go through and tweak my defend settings, and invade priorities today. I'm trying to decide between defend decision for every invade decision, or a smaller number of defend decisions to try and improve Ai defense of provinces.

  5. #65

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by alpaca
    Sorry I didn't explain my problem properly (was a bit tired )

    The actual problem is this: Sicily in II is much, much bigger than in vanilla, therefore it has 8 regions (may be 9, not quite sure). Not all of these belong to the Sicilian Emirates at the start. So I want them to try and take a few of the settlements, but they just seem to sit there like a duck. This doesn't seem to have anything to do with naval invasions as they didn't even plan any.

    What's even weirder is that I think it worked with the vanilla profile, so maybe I'll just have to investigate a bit more.

    Could just be the numbers possibly, as the invade priority seems to act as a kind of desire filter which includes distance between settlements as a factor in how desirable a target is?

    ~~~

    @CavalryCmdr

    Retried your opportunistic suggestion (without the spelling error this time). Works very well indeed for my "defensive" AI. Slower but more efficient and thereby ending up faster. Seems to be a lot less retreating going on with that setting so it may take more account of relative strength and attack more wisely. Very good tip.
    It's not a map.

  6. #66

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by Lusted
    Thanks for all the info nikolai/CavalryCmdr, i'm going to go through and tweak my defend settings, and invade priorities today. I'm trying to decide between defend decision for every invade decision, or a smaller number of defend decisions to try and improve Ai defense of provinces.

    Any feedback on what you think works best would be cool to hear. Particularly on the bit i bolded.

    RL stuff is interfering with my testing at the moment but i want to try and figure out some numbers soon,, if it's possible.
    It's not a map.

  7. #67
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    RL stuff is interfering with my testing at the moment but i want to try and figure out some numbers soon,, if it's possible.
    Same, so i haven't had a chance to try my reduced defend decisions yet, will hopefully be doing some of that today.

    What i'm thinking of doing is reducing the defend decisions to just defence options, then move all decisions relating to alliances, peace, protectorates etc. into the invade decisions so that those decisions can default to invade_none, whereas with defend decisions i'm worried that with multiple similar decisions but with one having a diplomatic decision and other the defend type define the diplomatic one might default to defend_normal or something.
    Last edited by Lusted; 12-06-2007 at 12:21.

  8. #68
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by nikolai1962
    Could just be the numbers possibly, as the invade priority seems to act as a kind of desire filter which includes distance between settlements as a factor in how desirable a target is?
    Probably not as other invade priorities are set to -1.

  9. #69
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    I've embarked on a complete redo of my AI, starting from scratch, instead of modifying existing versions. I'll report back on how it goes as it should be interesting.

    EDIT: early tests are promising, though i've got no code relating to alliances, wanting peace, protectorates in yet, or assigning invade priorities. I've based some of mine off of CavalryCmdrs work, but also doing a lot of it myself. Should be interesting to see how it performs once it's all done.
    Last edited by Lusted; 12-07-2007 at 14:00.

  10. #70
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    Right, here is now the basic invade and defend code for my AI(heavily influenced by this topic and CavalryCmdrs code as you can probably tell) that i'm fairly happy with, though it's still not quite as aggressive v rebels as i would like and it's not doing as many naval invasions as i'd like(i probably need to make some tweaks to the force invade settings). I'm now going to add in the relevant religious coding for certain profiles so i can then run a few test campaigns and make adjustments, and further adjustments to diplomacy.

    Invade:

    Code:
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-3" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="0.25"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					IF NEIGHBOUR AND WEAKER FRONTLINE > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="0.1"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.9"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLYS ENEMY AND NOT AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					IF NOT NEIGHBOUR
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMY OF TRUSTED ALLY > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR + RESOURCES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false" military_balance="1.1" free_strength_balance="1.1"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVE > REALLY WANT TO INVADE FOR QUICK BULDUP OF EMPIRES
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade_priority="20000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    Defend:
    Code:
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->		
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>

  11. #71

    Default Re: Campaign/Diplomacy AI

    Not the most productive comment, but I think exposing the AI will be one of M2TW's greatest things.
    Last edited by SigniferOne; 12-08-2007 at 01:09.

  12. #72
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    And lo the reason why my AI's been less aggressive comes to light, and of course the reasons not in the campaign AI file. It was this line in the config_ai_battle.xml file that i'd increased for this round of AI testing but forgot about:
    <friendly-to-enemy-strength-ratio>1.0</friendly-to-enemy-strength-ratio>
    I had it at 1.2, changing it to 1.0 made the AI expand more early on. So i think i'll stick with that setting from now on.

  13. #73

    Default Re: Campaign/Diplomacy AI

    That ratio determines what, the proportion of friendly-to-enemy units that would be considered evenly matched?

  14. #74
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    That ratio determines what, the proportion of friendly-to-enemy units that would be considered evenly matched?
    I think so, i believe it is linked to the ratio rating you get on battles(eg evenly matched etc).

  15. #75

    Default Re: Campaign/Diplomacy AI

    To follow up, increasing the ratio (assuming we're right about what it means) would make larger armies think they're only equal to smaller armies, and thus be a lot less willing to engage in battles?

  16. #76
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    To follow up, increasing the ratio (assuming we're right about what it means) would make larger armies think they're only equal to smaller armies, and thus be a lot less willing to engage in battles?
    Yes, the Ai would want to engage other stacks only when at an advantage.

  17. #77

    Default Re: Campaign/Diplomacy AI

    Is it possible to make the AI want to ally with the player when the player is a small (low number of settlements) or weak (small army) faction but ally against the player when they become larger (many settlements) more powerful (large army)?

    This would increase the usefulness of diplomacy because at the start of the game diplomactic agreements would benefit the player because they are less likely to be attacked but when the player is stronger they would act as a hinderance because the AI is more likely to ally against the player (if the AI allied factions would all declare war on and attack the player at the same time this would make the last part of the campaign more challenging than just annexing weaker factions).
    4 Seasons (6 Empires battle for supremecy); 3.0 version
    Total War Eras (start at 970, 1080, 1200, 1300, 1400, or 1500); 2.4 version
    Eras Total Conquest (start at 1230, 1346, 1547); 1.2 version

  18. #78
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    Is it possible to make the AI want to ally with the player when the player is a small (low number of settlements) or weak (small army) faction but ally against the player when they become larger (many settlements) more powerful (large army)?
    Yeah that's pretty easy, just a simple decision for the ally with small human thing with a max settlement number of 5 or something which has a positive pts_alliance number, and then one with a min settlements of say 15, or uses the military_balance, and have that give a negative pts_alliance number and also have an alliance_against setting. All fairly easy to do.

  19. #79

    Default Re: Campaign/Diplomacy AI

    What's the story with vassalage? Have you guys noticed whether AI goes passive under vassalage, and is this intended behavior?

  20. #80

    Default Re: Campaign/Diplomacy AI

    Sorry, emergency RL issues came up...

    Quote Originally Posted by nikolai1962
    @CavalryCmdr

    Retried your opportunistic suggestion (without the spelling error this time). Works very well indeed for my "defensive" AI. Slower but more efficient and thereby ending up faster. Seems to be a lot less retreating going on with that setting so it may take more account of relative strength and attack more wisely. Very good tip.
    In that case I'd say your ideas of how defend decisions offset invade priority are quite correct. Unfortunately invade_opportunistic is not ideal for the very reason it works well with your setup, it ignores invade priority completely, limiting control of the AI's behaviour specifically when fighting multiple fronts and should only be used when already at war with a faction, or with very strict decision settings.

    Quote Originally Posted by SigniferOne
    To follow up, increasing the ratio (assuming we're right about what it means) would make larger armies think they're only equal to smaller armies, and thus be a lot less willing to engage in battles?
    Trickyer to use then you'd think though as it also effects in-battle behaviour. Too high a setting can easily re-create the pasive battle AI bug, specifically in evenly matched battles.

    Quote Originally Posted by uanime5
    Is it possible to make the AI want to ally with the player when the player is a small (low number of settlements) or weak (small army) faction but ally against the player when they become larger (many settlements) more powerful (large army)?
    As Lusted said, easy, made even easier since vanilla descr_faction_standing.txt is already designd to create similar effects. However, doing so in a balanced manner to immitate 'intimidation' factor is a bit more complicated, specifically with 'alliance_against' being fubar.

    Quote Originally Posted by SigniferOne
    What's the story with vassalage? Have you guys noticed whether AI goes passive under vassalage, and is this intended behavior?
    According to the LTGD log the total for a vassal's invasion decision is "I'm a vassal so cannot attack." and it dosnt even prosess the invade decisions at all. This means a Vassal faction can only attack other armies in thier territory. I belive they still follow the hard-coded attack the human faction if use_cheat_overrides is set to true.

  21. #81

    Default Re: Campaign/Diplomacy AI

    Another thing you might want to change is the autoresolve, which has a limit so you can only kill / capture so many soldiers. While this is good for battles on the campaign map it is problematic when sieging the AI because autoresolving means you don't have to defeat the AI's whole army; leading to fewer casualties on your side, while the remaining soldiers in the AI armies all die when you capture the settlement. For sieges you should have to kill or capture most of the Ai's army when autoresolving.
    4 Seasons (6 Empires battle for supremecy); 3.0 version
    Total War Eras (start at 970, 1080, 1200, 1300, 1400, or 1500); 2.4 version
    Eras Total Conquest (start at 1230, 1346, 1547); 1.2 version

  22. #82
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    Here's my final campaign AI file if anyones interested in what i ended up with:

    Code:
    <?xml version="1.0"?>
    <root>
    	<!--
    
    		// The trusted ally global parameters specify the minimum faction standing thresholds for a target faction to be 
    		// considered a trusted ally.  We can use target faction standing parameters directly in invasion/defend decisions
    		// but the trusted ally data allows us to use additional entry parameters: trusted_ally_enemy and trusted_ally_protectorate
    		// that we cannot measure directly for a target faction.  An AI faction may also try and aid its trusted allies (hence the 
    		// reverse checks on standings to avoid helping allies it shouldn't)
    
    		<trusted_ally_fs_threshold float="0.4"/>                // min threshold for how much we like the target faction to consider them a trusted ally
    		<trusted_ally_target_fs_threshold float="0.4"/>         // min threshold for how much the target faction likes us to consider them a trusted ally
    		<trusted_ally_target_human_fs_threshold float="0.0"/>   // min threshold for how much the target (human) faction likes us to consider them a trusted ally
    		<trusted_ally_gs_threshold float="-1.0"/>               // min threshold for how trustworthy we are to consider the target faction a trusted ally
    		<trusted_ally_target_gs_threshold float="-0.1"/>        // min threshold for how trustworthy is the target faction to consider them a trusted ally
    		<trusted_ally_enemy_auto_war bool="false"/>        	// flag to indicate if a faction automatically goes to war with a trusted allies enemy
    
    		<use_cheat_overrides bool="true"/>                      // determines if cheat overrides (force peace with ai, force attack with humans) are applied
    		<invade_priority_fs_modifier float="-400.0"/>           // modifies the final invade priority for new faction targets by += (faction_standing * modifier) {makes factions more likely to start war with disliked targets}
    		<invade_priority_gs_modifier float="0.0f"/>             // modifies the final invade priority for new faction targets by += (global_standing * modifier) {makes factions more likely to start war with untrustworthy targets}
    		<invade_priority_assistance_offset int="200"/>          // modifies the final invade priority for new faction targets where military assistance has been asked by += (offset) {makes factions more likely to start war with military assistance targets}
    		<invade_priority_min int="50"/>                         // min clamp for final invade priorities calculated
    		<invade_priority_max int="1000"/>                       // max clamp for final invade priorities calculated
    
    
    		// Each faction has an 'ai_label' specified in the campaign descr_strat.txt.  This ai_label must correspond to a 'faction_ai_label' 
    		// entry specified in this database (e.g. 'default', 'catholic', 'papal_states').  The 'default' ai_label should always exist 
    		// and is used if a specified ai_label cannot be found.  Note that each ai_label is independent (i.e. 'catholic' ai_label does
    		// not inherit any data from 'default') hence care should be taken when adding new entries to ensure that any relevant global
    		// entries are added to all other ai_labels.  Additionally, the ai_labels can be tested through event conditions and set through
    		// a script command, potentially allowing ai behaviour to be changed dynamically in game depending on current game state.
    
    		<faction_ai_label name="default">	:: The label for a following set of campaign ai faction parameters
    		
    
    		// The ai_labels specify the structure of the long term goal director (LTGD) which drives the high level campaign AI.
    		// At the start of every factions turn (or when diplomacy changes), the LTGD is re-evaluated as follows:
    			// for every target faction (all other factions), evaluate the defend decisions
    			// for every target faction, evaluate the invasion decisions
    			// any invasion priorities are modified by the faction standing (relationship) towards the target
    			// depending on current game state, a new target with a high invasion priority may be selected to invade
    		// the LTGD can be debugged with the preferences '[log] level = ai.ltgd trace' and '[ai] ltgd_logging = true.
    
    			
    		// The 'defend_decisions' entry specifies a list of decision entries related to ai defence strategies.  To evaluate a defence
    		// strategy, a set of parameters is built and the list of decision entries is iterated until an entry satisfies the min and max
    		// conditions for the set of parameters.  As soon as an entry is satisfied (min <= current <= max), the iteration ends.  The decision
    		// is taken from the default 'faction_attitude' parameters with certain parameters overridden.  The 'min_entry' specifies the minimum
    		// thresholds specified for evaluation and the 'max_entry' specifies the maximum.  Note that care should be taken when entering new 
    		// entries since as soon as the thresholds for an entry are successfully met, the iteration ends.  An exception to this is the use of
    		// the 'continue' faction_attitude parameter, which allows the decision iteration to continue (This is useful for changing certain
    		// parameters of the faction_attitude but allowing the process to continue so other entries can apply additional modifications).
    
    		<defend_decisions>				:: List of ai defend 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 target 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
    							excommunicated="false"			:: is this faction 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
    							rand="0.0"					:: a random value
    							difficulty="easy"/>			:: the chosen difficulty for the current local player (easy, medium, hard, very_hard)
    							
    				<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"
    							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"
    							rand="1.0"
    							difficulty="very_hard"/>
    							
    				<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) (additive with previous decisions this turn)
    									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 (additive with previous decisions this turn). Compared with priority for decisions against all other factions to choose highest.  Value modified internally by faction standing.
    									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 (additive with previous decisions this turn)
    									pts_desire="0"					:: points total for measuring our desire for this faction's territory (additive with previous decisions this turn)
    									pts_alliance="0"				:: points total for measuring how much we want to be allies with these people (additive with previous decisions this turn)
    									can_force_invade="true"			:: can naval or forced invasion settings overwrite invade parameters
    									continue="false"/>				:: do we stop evaluating decision entries (false) or continue
    
    			</decision_entry>
    			
    		</defend_decisions>
    			
    	
    		// The 'invasion_decisions' entry specifies a list of invasion entries related to ai invasion strategies.  This process
    		// is virtually identical to the defence decision process but is evaluated as a separate stage.  
    
    		<invasion_decisions>				:: List of ai invasion decisions. when choosing a decision, code will iterate from first to last until a set of thresholds succeeds (uses identical data to defend decisions)
    
    			<decision_entry>				:: An individual decision entry
    				<min_entry/>											:: The minimum threshold for decision comparison
    				<max_entry/>											:: The maximum threshold for decision comparison
    				<faction_attitude/>									:: A list of modifiers to apply if min and max entries above are successful
    			</decision_entry>
    
    		</invasion_decisions>
    
        -->
        
        
    	<!--
    	//////////////////////
    	// GLOBAL AI PARAMS //
    	//////////////////////
    	-->
    
    	<trusted_ally_fs_threshold float="0.3"/>
    	<trusted_ally_target_fs_threshold float="0.3"/>
    	<trusted_ally_target_human_fs_threshold float="0.3"/>
    	<trusted_ally_gs_threshold float="-0.1"/>
    	<trusted_ally_target_gs_threshold float="-0.1"/>
    	<trusted_ally_enemy_auto_war bool="false"/>
    	
    	<use_cheat_overrides bool="false"/>
    	<invade_priority_fs_modifier float="-400.0"/>
    	<invade_priority_gs_modifier float="-200.0f"/>
    	<invade_priority_assistance_offset int="200"/>
    	<invade_priority_min int="50"/>
    	<invade_priority_max int="1500"/>
    	
    	<!--
    	///////////////////////////////////////
    	// DEFAULT AI PARAMS.  DO NOT REMOVE //
    	///////////////////////////////////////
    	-->
    
    	<faction_ai_label name="default">
    
    		<defend_decisions>
    
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->	
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    		<invasion_decisions>
    
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-2" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.75" free_strength_balance="0.75"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED AND LALST SETTLEMENT, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.8" free_strength_balance="0.8" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="0.25"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					IF NEIGHBOUR AND WEAKER FRONTLINE > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="0.1"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.9"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLYS ENEMY AND NOT AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					IF NOT NEIGHBOUR
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMY OF TRUSTED ALLY > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR + RESOURCES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false" military_balance="1.1" free_strength_balance="1.1"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVE > REALLY WANT TO INVADE FOR QUICK BULDUP OF EMPIRES
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade_priority="20000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    		</invasion_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">
    	
    		<defend_decisions>
    
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->	
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    		<invasion_decisions>
    
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DON'T ALLY ISLAMIC FACTIONS
    				-->
    				<min_entry	target_religion="islam"/>
    				<min_entry	target_religion="islam"/>
    				<faction_attitude	want_ally="false" pts_alliance="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					MAKE PAPACY UNLIKELY TO ALLY
    				-->
    				<min_entry	faction_standing="0.6" target_global_standing="0.4" enemy_excommunicated="false"/>
    				<max_entry	rand="0.15"/>
    				<faction_attitude	want_ally="true" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-2" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.75" free_strength_balance="0.75"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED AND LALST SETTLEMENT, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.8" free_strength_balance="0.8" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true" faction_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true" global_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					FOR CATHOLICS
    				-->
    
    			<decision_entry>
    				<!--
    					IF TARGET NOT EXCOMMUNICATED, CANNOT FORCE INVADE, INVADE NONE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" enemy_excommunicated="false"/>
    				<max_entry	is_neighbour="true" enemy_excommunicated="false"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" invade_priority="-400" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF CEASE HOSTILITIES, INVADE NONE, CANNOT FORCE INVADE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	faction_standing="-0.25" has_ceasehostilities="true" global_standing="-0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" invade_priority="-250" continue="true"/>
    			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					IF CEASE HOSTILITIES, INVADE NONE, CANNOT FORCE INVADE, REDUCE INVADE PRIORITY, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	has_ceasehostilities="true"/>
    				<max_entry	rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET NON-EXCOMMUNICATED CATHOLIC AND WE LIKE THEM, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false" target_faction_standing="-0.1" target_global_standing="-0.1"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET NON-EXCOMMUNICATED CATHOLIC, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					MAKE PAPACY INVADE LESS
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="100" continue="true"/>
    			</decision_entry>
    
    				<!--
    				IMPROVEMENTS TO CRUSADES
    				-->
    
    			<decision_entry>
    				<!--
    					IF ISLAMIC AND LOW FACTION STANDINGS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	target_religion="islam" faction_standing="-1.0"/>
    				<max_entry	target_religion="islam" faction_standing="-0.7"/>
    				<faction_attitude	can_force_invade="true" invade="invade_immediate" invade_priority="1000" continue="true"/>
    			</decision_entry>	
    
    		</invasion_decisions>
    		
    	</faction_ai_label>
    	
    
    	<!--
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	// CATHOLIC FACTION AI PARAMS.  REQUIRES SPECIAL STUFF TO REDUCE ATTACKING NON-EXCOMMUNICATED CATHOLIC FACTIONS //
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="catholic">	
    	
    		<defend_decisions>
    
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->	
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    		<invasion_decisions>
    
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DON'T ALLY WITH ISLAMIC FACTIONS
    				-->
    				<min_entry	target_religion="islam"/>
    				<max_entry	target_religion="islam"/>
    				<faction_attitude	want_ally="false" pts_alliance="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-2" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.75" free_strength_balance="0.75"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED AND LALST SETTLEMENT, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.8" free_strength_balance="0.8" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true" faction_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true" global_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					FOR CATHOLICS
    				-->
    
    			<decision_entry>
    				<!--
    					IF PAPAL STATES AND LIKE US, INVADE NONE, CANNOT FORCE INVADE
    				-->
    				<min_entry	target_faction="papal_states" target_faction_standing="-0.5"/>
    				<max_entry	target_faction="papal_states"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					IF CEASE HOSTILITIES, INVADE NONE, CANNOT FORCE INVADE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	faction_standing="-0.25" has_ceasehostilities="true" global_standing="-0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" invade_priority="-250" continue="true"/>
    			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					IF CEASE HOSTILITIES, INVADE NONE, CANNOT FORCE INVADE, REDUCE INVADE PRIORITY, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	has_ceasehostilities="true"/>
    				<max_entry	rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET NON-EXCOMMUNICATED CATHOLIC AND WE LIKE THEM, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false" target_faction_standing="-0.1" target_global_standing="-0.1"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET NON-EXCOMMUNICATED CATHOLIC, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					IF NEIGHBOUR AND WEAKER FRONTLINE > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="0.1"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.9"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLYS ENEMY AND NOT AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					IF NOT NEIGHBOUR
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMY OF TRUSTED ALLY > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR + RESOURCES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false" military_balance="1.1" free_strength_balance="1.1"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVE > REALLY WANT TO INVADE FOR QUICK BULDUP OF EMPIRES
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade_priority="20000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    				<!--
    				IMPROVEMENTS TO CRUSADES
    				-->
    
    			<decision_entry>
    				<!--
    					IF ISLAMIC AND LOW FACTION STANDINGS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	target_religion="islam" faction_standing="-1.0"/>
    				<max_entry	target_religion="islam" faction_standing="-0.7"/>
    				<faction_attitude	can_force_invade="true" invade="invade_immediate" invade_priority="1000" continue="true"/>
    			</decision_entry>
    
    		</invasion_decisions>
    		
    	</faction_ai_label>
    	
    
    	<!--
    	///////////////////////////////////////
    	// MONGOL AI PARAMTERS 		     //
    	///////////////////////////////////////
    	-->
    
    	<faction_ai_label name="mongol">
    	
    		<defend_decisions>
    
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->	
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    		<invasion_decisions>
    
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-2" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.75" free_strength_balance="0.75"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED AND LALST SETTLEMENT, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.8" free_strength_balance="0.8" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true" faction_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true" global_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					IF NEIGHBOUR AND WEAKER FRONTLINE > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="0.1"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.9"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLYS ENEMY AND NOT AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					IF NOT NEIGHBOUR
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMY OF TRUSTED ALLY > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR + RESOURCES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false" military_balance="1.1" free_strength_balance="1.1"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_immediate" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVE > REALLY WANT TO INVADE FOR QUICK BULDUP OF EMPIRES
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade_priority="20000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    		</invasion_decisions>
    		
    	</faction_ai_label>
    
    	<!--
    	///////////////////////////////////////
    	// ISLAMIC AI PARAMS.   //
    	///////////////////////////////////////
    	-->
    
    	<faction_ai_label name="islam">
    	
    		<defend_decisions>
    
    				<!--
    					DEFEND
    				-->
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND EVEN > DEFEND FORTIFIED
    				-->
    				<min_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND WEAKER > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" military_balance="0.75" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND STRONGER > DEFEND FRONTLINE
    				-->
    				<min_entry	stance="AtWar" military_balance="1.75" is_neighbour="true"/>
    				<max_entry	stance="AtWar"is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY > DEFEND NORMAL
    				-->
    				<min_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<max_entry	 trusted_ally="true" stance="Allied" target_human="false" is_neighbour="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND NOT AT WAR > DEFEND FORTIFIED
    				-->
    				<min_entry	target_human="true" is_neighbour="true"/>
    				<max_entry	target_human="true" is_neighbour="true"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF HUMAN AND AT WAR > DEFEND DEEP
    				-->
    				<min_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<max_entry	stance="AtWar" target_human="true" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_deep" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_minimal" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DEFEND v SLAVES
    				-->	
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NOT NEIGHBOUR > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="false"/>
    				<max_entry	target_faction="slave" is_neighbour="false"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR AND EARLY GAME > DEFEND MINIMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" turn_number="30" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_minimal" want_peace="false" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVE AND NEIGHBOUR > DEFEND NORMAL
    				-->
    				<min_entry	target_faction="slave" is_neighbour="true"/>
    				<max_entry	target_faction="slave" is_neighbour="true"/>
    				<faction_attitude	at_war="true" defense="defend_frontline" want_peace="false" continue="false"/>
    			</decision_entry>
    
    		</defend_decisions>
    
    		<invasion_decisions>
    
    				<!--
    					DEFAULT
    				-->
    
    			<decision_entry>
    				<!--
    					DEFAULT INVADE NONE
    				-->
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DIPLOMACY
    				-->
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					BY DEFAULT DON'T WANT TO ALLY
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					DON'T ALLY WITH CATHOLIC FACTIONS
    				-->
    				<min_entry	target_religion="catholic"/>
    				<max_entry	target_religion="catholic"/>
    				<faction_attitude	want_ally="false" pts_alliance="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					WANT ALLY WITH ISLAMIC FACTIONS
    				-->
    				<min_entry	target_religion="islam"/>
    				<max_entry	target_religion="islam"/>
    				<faction_attitude	want_ally="true" pts_alliance = "10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	trusted_ally="true" rand="0.9"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ALLIED AND TRUSTWORTHY AND ONLY ALLIED SHORT WHILE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	stance="Allied" global_standing="0.25"/>
    				<max_entry	stance="Allied" num_turns_allied="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF ONLY ALLIED FOR SHORT TIME, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<max_entry	stance="Allied"/>
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO AND RELATIVELY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AGREED TO CEASEFIRE SHORT TIME AGO, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND VERY TRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND LIKE THEM ALOT AND NOT UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					IF ALLIED AND WE DON'T MIND THEM, AND NOT TOO UNTRUSTWORTHY, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY
    				-->
    				<min_entry	stance="Allied" faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.5"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.25"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					PARTIALLY FRIENDLY NEUTRAL, CANNOT FORCE INVADE, INVADE NONE, RANDOMISED SLIGHTLY 
    				-->
    				<min_entry	stance="Neutral" faction_standing="0.0"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	is_protectorate="true" />
    				<max_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY PROTECTORATE, CANNOT FORCE INVADE, INVADE NONE
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<max_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, ALLIANCE AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES, DON'T ALLY AGAINST
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-2" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE MUCH STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER ON FRONTLINE, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	stance="AtWar" frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY'RE STRONGER IN FREE STRENGTH, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	stance="AtWar" free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND THEY OUTPRODUCE US, ALLY AGAINST
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF NOT AT WAR AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	strongest_neighbour="true" production_balance="1.0" num_enemies="0" />
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCE AND STRONGEST NEIGHBOUR, ALLY AGAINST
    				-->
    				<min_entry	strongest_neighbour="true" production_balance="1.0"/>
    				<max_entry	strongest_neighbour="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MOST DESIRABLE, ALLY AGAINST
    				-->
    				<min_entry	most_desirable="true" production_balance="1.0"/>
    				<max_entry	most_desirable="true" num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY SUPERIOR, OFFER PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	want_offer_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND VASTLY OUTNUMBERED, WANT BE PROTECT
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" />
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.75" free_strength_balance="0.75"/>
    				<faction_attitude	want_peace="true" continue="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND OUTNUMBERED AND LALST SETTLEMENT, WANT PEACE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="0.8" free_strength_balance="0.8" num_settlements="3"/>
    				<faction_attitude	want_peace="true" want_be_protect="true" continue="false"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    				<!--
    					DECIDE WHO TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0"/>
    				<max_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF STRONGER ON FRONTLINE, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="1.0"/>
    				<max_entry	is_neighbour="true" military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="2.0"/>
    				<max_entry	is_neighbour="true" military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF MORE POWERFUL MILITARY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET AT WAR WITH LOTS OF FACTIONS, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="1.0"/>
    				<max_entry	is_neighbour="true" production_balance="2.0"/>
    				<faction_attitude	invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="2.0"/>
    				<max_entry	is_neighbour="true" production_balance="3.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUT PRODUCE THEM, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" production_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE AGAINST, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" has_alliance_against="true"/>
    				<max_entry	is_neighbour="true" has_alliance_against="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="1.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="2.0"/>
    				<max_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ALLIANCE MILITARY STRONGER, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" alliance_military_balance="3.0"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.75"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.5"/>
    				<max_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF DISLIKE FACTION, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="-0.25"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF UNTRUSTOWRTHY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.5"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar"/>
    				<max_entry	is_neighbour="true" stance="AtWar"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_human="true"/>
    				<max_entry	is_neighbour="true" target_human="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="hard"/>
    				<max_entry	is_neighbour="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TARGET HUMAN AND DIFFICULTY VERY HARD HARD, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" difficulty="very_hard"/>
    				<max_entry	is_neighbour="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKEST NEIGHBOUR, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<max_entry	is_neighbour="true" target_weakest_neighbour="true"/>
    				<faction_attitude	invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY ENEMY, INCREASE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade_priority="75" continue="true"/>
    			</decision_entry>
    
    				<!--
    					DECIDE WHO NOT TO INVADE
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1"/>
    				<max_entry	is_neighbour="true" num_enemies="2"/>
    				<faction_attitude	invade_priority="-100" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="2"/>
    				<max_entry	is_neighbour="true" num_enemies="3"/>
    				<faction_attitude	invade_priority="-150" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF ENEMIES, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" num_enemies="3"/>
    				<max_entry	is_neighbour="true"/>
    				<faction_attitude	invade_priority="-200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER FRONTLINE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF WEAKER MILITARY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" military_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF OUTPRODUCED, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" production_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF GOOD STANDINGS, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" faction_standing="0.35"/>
    				<max_entry	is_neighbour="true" faction_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTWORTHY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" global_standing="0.4"/>
    				<max_entry	is_neighbour="true" global_standing="1.0"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF LOW FREE STRENGTH VALUE, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true"/>
    				<max_entry	is_neighbour="true" free_strength_balance="0.7"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLY, REDUCE INVADE PRIORITY
    				-->
    				<min_entry	is_neighbour="true" trusted_ally="true"/>
    				<max_entry	is_neighbour="true" trusted_ally="true"/>
    				<faction_attitude	invade_priority="-50" continue="true"/>
    			</decision_entry>
    
    				<!--
    					EARLY GAME
    				-->
    
    			<decision_entry>
    				<!--
    					IF EARLY GAME, INVADE NONE
    				-->
    				<min_entry	stance="Neutral"/>
    				<max_entry	stance="Neutral" turn_number="10"/>
    				<faction_attitude	can_force_invade="false" invade="invade_none" continue="false"/>
    			</decision_entry>
    
    				<!--
    					INVADES FOR NEIGHBOURS
    				-->
    
    			<decision_entry>
    				<!--
    					IF NEIGHBOUR AND WEAKER FRONTLINE > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="0.1"/>
    				<max_entry	is_neighbour="true" frontline_balance="0.9"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF TRUSTED ALLYS ENEMY AND NOT AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="true" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND HE IS SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true"/>
    				<max_entry	stance="AtWar" is_neighbour="true"  military_balance="0.9" free_strength_balance="0.9"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	stance="AtWar" is_neighbour="true" frontline_balance="1.5"/>
    				<max_entry	stance="AtWar" is_neighbour="true" frontline_balance="100.0"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    				<!--
    					IF NOT NEIGHBOUR
    				-->
    
    			<decision_entry>
    				<!--
    					IF ENEMY OF TRUSTED ALLY > INVADE BUILDUP
    				-->
    				<min_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<max_entry	is_neighbour="false" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR > INVADE BUILDUP
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_buildup" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF AT WAR + RESOURCES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	stance="AtWar" is_neighbour="false" military_balance="1.1" free_strength_balance="1.1"/>
    				<max_entry	stance="AtWar" is_neighbour="false"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true" can_force_invade="true"/>
    			</decision_entry>
    
    				<!--
    					SLAVE
    				-->
    
    			<decision_entry>
    				<!--
    					IF SLAVE > REALLY WANT TO INVADE FOR QUICK BULDUP OF EMPIRES
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade_priority="20000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_opportunistic" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SLIGHTLY SUPERIOR > INVADE OPPORTUNISTIC
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_buildup" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND SUPERIOR > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					IF SLAVES AND EARLY GAME > INVADE IMMEDIATE
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	target_faction="slave" turn_number="30"/>
    				<faction_attitude	at_war="true" invade="invade_immediate" invade_priority="2000" continue="true"/>
    			</decision_entry>
    
    		</invasion_decisions>
    		
    	</faction_ai_label>
    
    	
    
    	<!--
    	/////////////////////////////////////////////////////////////
    	// SLAVE FACTION AI PARAMS.  THEY DON'T REALLY DO ANYTHING //
    	/////////////////////////////////////////////////////////////
    	-->
    
    	<faction_ai_label name="slave_faction">
    	
    		<invasion_decisions>
    
    			<decision_entry>
    				<!--
    					Hopefully make rebels more aggressive
    				-->
    				<faction_attitude	invade="invade_opportunistic" invade_priority="550"/>
    			</decision_entry>
    
    			<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>
    	
    	
    </root>
    And here's my diplomacy file:

    Code:
    <?xml version="1.0"?>
    <root>
       <item_modifiers>
            <item name="offer_payment">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="offer_protectorate">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_alliance">
                <cost	            modifier="0.5"/>
    			<faction_standing   modifier="0.5"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_recommunication">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.95"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="offer_cardinal_vote">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.35"/>
    			<global_standing    modifier="0.25"/>
            </item>
            <item name="offer_marry_heir">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_marry_leader">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_marry_heir_to_princess">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_marry_leader_to_princess">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_ceasefire">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.35"/>
            </item>
            <item name="offer_trade_rights">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_military_access">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_map_information">
                <cost	            modifier="0.25"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_yearly_payment">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.25"/>
            </item>
            <item name="offer_cede_region">
                <cost	            modifier="2.5"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="offer_attack_faction">
                <cost	            modifier="0.01"/>
    			<faction_standing   modifier="0.5"/>
    			<global_standing    modifier="0.75"/>
            </item>
            <item name="offer_threat_of_attack">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="stopping_offer_payment">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="declare_nullify_alliance">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="declare_cancel_trade_rights">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="declare_cancel_military_access">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="demand_payment">
                <cost	            modifier="0.5"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="demand_protectorate">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="demand_recommunication">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.95"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="demand_cardinal_vote">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.25"/>
            </item>
            <item name="demand_military_access">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="demand_map_information">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="stopping_demand_payment">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.0"/>
    			<global_standing    modifier="0.0"/>
            </item>
            <item name="demand_yearly_payment">
                <cost	            modifier="1.0"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.25"/>
            </item>
            <item name="demand_cede_region">
                <cost	            modifier="3.5"/>
    			<faction_standing   modifier="0.25"/>
    			<global_standing    modifier="0.5"/>
            </item>
            <item name="demand_attack_faction">
                <cost	            modifier="2.0"/>
    			<faction_standing   modifier="0.5"/>
    			<global_standing    modifier="0.5"/>
            </item>
       </item_modifiers>
       
       <demeanours>
          <!--
            <demeanour_state name="ai_accepts">
    			<demeanour_entry>
    				<upper_threshold upper_thresh="0.1"/>
    				<diplomacy_text	name="DDS_ACCEPT_LOW"/>
    				<character_voice name="Offer_Accepted_Close"/>
    			</demeanour_entry>
            </demeanour_state>
            -->
            <demeanour_state name="new_offer">
    			<demeanour_entry>
    				<upper_threshold value="-5.0"/>
    				<diplomacy_text	name="DDS_NEW_OFFER_WORSE"/>
    				<character_voice name="New_Offer_Worse"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="5.0"/>
    				<diplomacy_text	name="DDS_NEW_OFFER_NEUTRAL"/>
    				<character_voice name="New_Offer_Neutral"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_NEW_OFFER_BETTER"/>
    				<character_voice name="New_Offer_Better"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_accepts">
    			<demeanour_entry>
    				<upper_threshold value="0.0"/>
    				<diplomacy_text	name="DDS_ACCEPT_EXTORTION"/>
    				<character_voice name="Offer_Accepted_Extortion"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="1.0"/>
    				<diplomacy_text	name="DDS_ACCEPT_LOW"/>
    				<character_voice name="Offer_Accepted_Close"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="10.0"/>
    				<diplomacy_text	name="DDS_ACCEPT_MED"/>
    				<character_voice name="Offer_Accepted_Standard"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_ACCEPT_HIGH"/>
    				<character_voice name="Offer_Accepted_Generous"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_declines">
    			<demeanour_entry>
    				<upper_threshold value="-10.0"/>
    				<diplomacy_text	name="DDS_DECLINE_HIGH"/>
    				<character_voice name="Offer_Declined_insulting"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-1.0"/>
    				<diplomacy_text	name="DDS_DECLINE_MED"/>
    				<character_voice name="Offer_Declined_Standard"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_DECLINE_LOW"/>
    				<character_voice name="Offer_Declined_Close"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_rejects">
    			<demeanour_entry>
    				<upper_threshold value="-10.0"/>
    				<diplomacy_text	name="DDS_REJECT_HIGH"/>
    				<character_voice name="Offer_Rejected_insulting"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-1.0"/>
    				<diplomacy_text	name="DDS_REJECT_MED"/>
    				<character_voice name="Offer_Rejected_Standard"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_REJECT_LOW"/>
    				<character_voice name="Offer_Rejected_Close"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_counters">
    			<demeanour_entry>
    				<upper_threshold value="-10.0"/>
    				<diplomacy_text	name="DDS_COUNTER_INSULTING"/>
    				<character_voice name="Offer_Countered_Insulting"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-1.0"/>
    				<diplomacy_text	name="DDS_COUNTER_STANDARD"/>
    				<character_voice name="Offer_Countered_Standard"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_COUNTER_CLOSE"/>
    				<character_voice name="Offer_Countered_Close"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_counters_open">
    			<demeanour_entry>
    				<upper_threshold value="-1.0"/>
    				<diplomacy_text	name="DDS_COUNTER_OPEN"/>
    				<character_voice name="Offer_Countered_Open_Negative"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="1.0"/>
    				<diplomacy_text	name="DDS_COUNTER_OPEN"/>
    				<character_voice name="Offer_Countered_Open_Neutral"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_COUNTER_OPEN"/>
    				<character_voice name="Offer_Countered_Open_Positive"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_acknowledges_declare">
    			<demeanour_entry>
    				<upper_threshold value="-10.0"/>
    				<diplomacy_text	name="DDS_DECLARE_UPSET"/>
    				<character_voice name="Demeanour_Declare_Upset"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-5.0"/>
    				<diplomacy_text	name="DDS_DECLARE_ANNOYED"/>
    				<character_voice name="Demeanour_Declare_Annoyed"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_DECLARE_UNCONCERNED"/>
    				<character_voice name="Demeanour_Declare_Unconcerned"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="player_rejects">
    			<demeanour_entry>
    				<upper_threshold value="-1.5"/>
    				<diplomacy_text	name="DDS_REACTION_OFFENDED"/>
    				<character_voice name="Demeanour_Reaction_Offended"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-0.75"/>
    				<diplomacy_text	name="DDS_REACTION_DISAPPOINTED"/>
    				<character_voice name="Demeanour_Reaction_Disappointed"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_REACTION_NEUTRAL"/>
    				<character_voice name="Demeanour_Reaction_Neutral_Rejected"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="player_accepts">
    			<demeanour_entry>
    				<upper_threshold value="0.75"/>
    				<diplomacy_text	name="DDS_REACTION_NEUTRAL"/>
    				<character_voice name="Demeanour_Reaction_Neutral"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="1.5"/>
    				<diplomacy_text	name="DDS_REACTION_PLEASED"/>
    				<character_voice name="Demeanour_Reaction_Pleased"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_REACTION_ELATED"/>
    				<character_voice name="Demeanour_Reaction_Elated"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="ai_farewells">
    			<demeanour_entry>
    				<upper_threshold value="-5.0"/>
    				<character_voice name="Outro_Demeanour_Worse"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="5.0"/>
    				<character_voice name="Outro_Demeanour_Neutral"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<character_voice name="Outro_Demeanour_Better"/>
    			</demeanour_entry>        
            </demeanour_state>
            <demeanour_state name="proposal_balance">
    			<demeanour_entry>
    				<upper_threshold value="-10.0"/>
    				<diplomacy_text	name="DDS_BALANCE_VERY_DEMANDING"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="-5.0"/>
    				<diplomacy_text	name="DDS_BALANCE_DEMANDING"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="5.0"/>
    				<diplomacy_text	name="DDS_BALANCE_BALANCED"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<upper_threshold value="10.0"/>
    				<diplomacy_text	name="DDS_BALANCE_GENEROUS"/>
    			</demeanour_entry>
    			<demeanour_entry>
    				<diplomacy_text	name="DDS_BALANCE_VERY_GENEROUS"/>
    			</demeanour_entry>        
            </demeanour_state>
        </demeanours>
        <diplomacy_text_fields>
    		<text_field name="relations">
    			<text_entry>
    				<upper_threshold value="-0.8"/>
    				<diplomacy_text name="DT_RELATIONS_0"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.6"/>
    				<diplomacy_text name="DT_RELATIONS_1"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.4"/>
    				<diplomacy_text name="DT_RELATIONS_2"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.25"/>
    				<diplomacy_text name="DT_RELATIONS_3"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.1"/>
    				<diplomacy_text name="DT_RELATIONS_4"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.1"/>
    				<diplomacy_text name="DT_RELATIONS_5"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.25"/>
    				<diplomacy_text name="DT_RELATIONS_6"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.4"/>
    				<diplomacy_text name="DT_RELATIONS_7"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.6"/>
    				<diplomacy_text name="DT_RELATIONS_8"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.8"/>
    				<diplomacy_text name="DT_RELATIONS_9"/>
    			</text_entry>
    			<text_entry>
    				<diplomacy_text name="DT_RELATIONS_10"/>
    			</text_entry>
    		</text_field>
    		<text_field name="reputation">
    			<text_entry>
    				<upper_threshold value="-0.8"/>
    				<diplomacy_text name="DT_REPUTATION_0"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.6"/>
    				<diplomacy_text name="DT_REPUTATION_1"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.4"/>
    				<diplomacy_text name="DT_REPUTATION_2"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.25"/>
    				<diplomacy_text name="DT_REPUTATION_3"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="-0.1"/>
    				<diplomacy_text name="DT_REPUTATION_4"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.1"/>
    				<diplomacy_text name="DT_REPUTATION_5"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.25"/>
    				<diplomacy_text name="DT_REPUTATION_6"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.4"/>
    				<diplomacy_text name="DT_REPUTATION_7"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.6"/>
    				<diplomacy_text name="DT_REPUTATION_8"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="0.8"/>
    				<diplomacy_text name="DT_REPUTATION_9"/>
    			</text_entry>
    			<text_entry>
    				<diplomacy_text name="DT_REPUTATION_10"/>
    			</text_entry>
    		</text_field>
    		<text_field name="power">
    			<text_entry>
    				<upper_threshold value="5000.0"/>
    				<diplomacy_text name="DT_POWER_0"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="15000.0"/>
    				<diplomacy_text name="DT_POWER_1"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="25000.0"/>
    				<diplomacy_text name="DT_POWER_2"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="35000.0"/>
    				<diplomacy_text name="DT_POWER_3"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="45000.0"/>
    				<diplomacy_text name="DT_POWER_4"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="55000.0"/>
    				<diplomacy_text name="DT_POWER_5"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="65000.0"/>
    				<diplomacy_text name="DT_POWER_6"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="75000.0"/>
    				<diplomacy_text name="DT_POWER_7"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="85000.0"/>
    				<diplomacy_text name="DT_POWER_8"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="95000.0"/>
    				<diplomacy_text name="DT_POWER_9"/>
    			</text_entry>
    			<text_entry>
    				<diplomacy_text name="DT_POWER_10"/>
    			</text_entry>
    		</text_field>
    		<text_field name="wealth">
    			<text_entry>
    				<upper_threshold value="2500.0"/>
    				<diplomacy_text name="DT_WEALTH_0"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="7500.0"/>
    				<diplomacy_text name="DT_WEALTH_1"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="12500.0"/>
    				<diplomacy_text name="DT_WEALTH_2"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="17500.0"/>
    				<diplomacy_text name="DT_WEALTH_3"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="22500.0"/>
    				<diplomacy_text name="DT_WEALTH_4"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="27500.0"/>
    				<diplomacy_text name="DT_WEALTH_5"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="32500.0"/>
    				<diplomacy_text name="DT_WEALTH_6"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="37500.0"/>
    				<diplomacy_text name="DT_WEALTH_7"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="42500.0"/>
    				<diplomacy_text name="DT_WEALTH_8"/>
    			</text_entry>
    			<text_entry>
    				<upper_threshold value="47500.0"/>
    				<diplomacy_text name="DT_WEALTH_9"/>
    			</text_entry>
    			<text_entry>
    				<diplomacy_text name="DT_WEALTH_10"/>
    			</text_entry>
    		</text_field>
        </diplomacy_text_fields>
    </root>
    And my faction standings file:


    Code:
    ; faction standing parameters
    ; ===========================
    
    ; initialisation parameters
    
    min_faction_standing	-1.0
    max_faction_standing	1.0
    
    relations_improved_thresholds
    {
        0.25
        0.4
        0.6
    }
    
    relations_worsened_thresholds
    {
        -0.8
        -0.4
        -0.25
    }
    
    ; trigger information
    ; faction_standing updated with the command:
    ;   FactionStanding [AFFECTED_HANDLE] [affected_handle_parameters] opt:[MODIFER_HANDLE] opt:[modifier_handle_parameter_1] opt:[modifier_handle_parameter_1]
    ;
    ; Available AFFECTED_HANDLE's and their parameters are as follows:
    ;
    ;    factions { [faction_label_1] [faction_label_2] [etc] }		--> A list of factions to be affected, (own faction automatically excluded)
    ;    target_faction							--> the target_faction attached to the event, (own faction automatically excluded)
    ;    religion [religion_label]						--> all factions of the specified religion, (own faction automatically excluded)
    ;    own_religion							--> all factions of the same religion as the faction of the event, (own faction automatically excluded)
    ;    target_religion							--> all factions of the same religion as the target faction of the event, (own faction automatically excluded)
    ;    global								--> the faction of the event (i.e. own faction)
    ;    exclude_factions { [faction_label_1] [faction_label_2] [etc] }	--> A list of factions not to be affected, (own faction automatically excluded)
    ;    allies								--> all factions allied with the faction attached to the trigger
    ;    enemies								--> all factions at war with the faction attached to the trigger
    ;    target_allies							--> all factions allied with the target faction attached to the trigger
    ;    target_enemies							--> all factions at war with the target_faction attached to the trigger
    ;
    ; Available MODIFIER_HANDLE's and their corresponding parameters
    ;
    ;    [value]					--> add this 'value' to the affected faction standings
    ;    amount [divisor] [value]			--> for every 'divisor' unit of the event amount, add 'value' to the affected faction standings
    ;    income [divisor] [value]			--> for every 'divisor' unit of the event factions income, add 'value' to the affected faction standings
    ;    normalise [target_faction_standing] [divisor]	--> for each affected faction standing, add (target_faction_standing - faction_standing)/divisor
    ;    per_unit [value]				--> for each unit in the events army, add 'value' to the affected faction standings
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; BUILD RELIGIOUS STRUCTURE ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ;------------------------------------------
    Trigger 0001_P_Build_Small_Church
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = small_church
    
        FactionStanding factions { papal_states } 0.02
    
    ;------------------------------------------
    Trigger 0002_P_Build_Church
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = church
    
        FactionStanding factions { papal_states } 0.04
    
    ;------------------------------------------
    Trigger 0003_P_Build_Abbey
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = abbey
    
        FactionStanding factions { papal_states } 0.06
    
    ;------------------------------------------
    Trigger 0004_P_Build_Cathedral
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = cathedral
    
        FactionStanding factions { papal_states } 0.16
    
    ;------------------------------------------
    Trigger 0005_P_Build_Huge_Cathedral
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = huge_cathedral
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0006_P_Build_Small_Chapel
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = small_chapel
    
        FactionStanding factions { papal_states } 0.02
    
    ;------------------------------------------
    Trigger 0007_P_Build_Chapel
        WhenToTest BuildingCompleted
    
        Condition SettlementBuildingFinished = chapel
    
        FactionStanding factions { papal_states } 0.04
    
    ;------------------------------------------
    Trigger 0008_P_Built_First_Small_Church_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction small_church = 1
    
        FactionStanding factions { papal_states } 0.04
    
    ;------------------------------------------
    Trigger 0009_P_Built_First_Church_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction church = 1
    
        FactionStanding factions { papal_states } 0.08
    
    ;------------------------------------------
    Trigger 0010_P_Built_First_Abbey_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction abbey = 1
    
        FactionStanding factions { papal_states } 0.12
    
    ;------------------------------------------
    Trigger 0011_P_Built_First_Cathedral_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction cathedral = 1
    
        FactionStanding factions { papal_states } 0.16
    
    ;------------------------------------------
    Trigger 0012_P_Built_First_Huge_Cathedral_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction huge_cathedral = 1
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0013_P_Built_First_Small_Chapel_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction small_chapel = 1
    
        FactionStanding factions { papal_states } 0.04
    
    ;------------------------------------------
    Trigger 0014_P_Built_First_Chapel_Faction
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompletedFaction chapel = 1
    
        FactionStanding factions { papal_states } 0.08
    
    ;------------------------------------------
    Trigger 0015_P_Built_First_Cathedral_World
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompleted cathedral = 1
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0016_P_Built_First_Huge_Cathedral_World
        WhenToTest BuildingCompleted
    
        Condition NumBuildingsCompleted huge_cathedral = 1
    
        FactionStanding factions { papal_states } 0.2
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; DESTROY RELIGIOUS STRUCTURE ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0017_P_Destroy_Small_Church
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = small_church
    
        FactionStanding factions { papal_states } -0.1
    
    ;------------------------------------------
    Trigger 0018_P_Destroy_Church
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = church
    
        FactionStanding factions { papal_states } -0.2
    
    ;------------------------------------------
    Trigger 0019_P_Destroy_Abbey
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = abbey
    
        FactionStanding factions { papal_states } -0.4
    
    ;------------------------------------------
    Trigger 0020_P_Destroy_Cathedral
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = cathedral
    
        FactionStanding factions { papal_states } -0.6
    
    ;------------------------------------------
    Trigger 0021_P_Destroy_Huge_Cathedral
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = huge_cathedral
    
        FactionStanding factions { papal_states } -1.0
    
    ;------------------------------------------
    Trigger 0022_P_Destroy_Small_Chapel
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = small_chapel
    
        FactionStanding factions { papal_states } -0.1
    
    ;------------------------------------------
    Trigger 0023_P_Destroy_Chapel
        WhenToTest BuildingDestroyed
    
        Condition BuildingName = chapel
    
        FactionStanding factions { papal_states } -0.2
    
    ;
    ;;;; TBD buildings destroyed in battle
    
    
    ;;;;;;;;;;;;;;
    ;; CRUSADES ;;
    ;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0050_P_General_Arrives_Crusade_Target
        WhenToTest GeneralArrivesCrusadeTargetRegion
    
        Condition IsCrusade
    
        FactionStanding factions { papal_states } 0.1
        FactionStanding factions { papal_states } per_unit 0.001
    
    ;------------------------------------------
    Trigger 0051_P_Heir_Arrives_Crusade_Target
        WhenToTest GeneralArrivesCrusadeTargetRegion
    
        Condition IsCrusade
                  and IsFactionHeir
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0052_P_King_Arrives_Crusade_Target
        WhenToTest GeneralArrivesCrusadeTargetRegion
    
        Condition IsCrusade
                  and IsFactionLeader
    
        FactionStanding factions { papal_states } 0.6
    
    ;------------------------------------------
    Trigger 0053_P_General_Takes_Crusade_Target
        WhenToTest GeneralTakesCrusadeTarget
    
        Condition IsCrusade
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0054_P_Heir_Takes_Crusade_Target
        WhenToTest GeneralTakesCrusadeTarget
    
        Condition IsCrusade
                  and IsFactionHeir
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0055_P_King_Takes_Crusade_Target
        WhenToTest GeneralTakesCrusadeTarget
    
        Condition IsCrusade
                  and IsFactionLeader
    
        FactionStanding factions { papal_states } 0.6
    
    ;------------------------------------------
    Trigger 0056_P_Army_Takes_Crusade_Target
        WhenToTest ArmyTakesCrusadeTarget
    
        Condition IsCrusade
    
        FactionStanding factions { papal_states } per_unit 0.002
    
    ;------------------------------------------
    Trigger 0057_P_Character_Attacks_Crusading_General
        WhenToTest CharacterAttacksCrusadingGeneral
    
        Condition IsTargetOnCrusade
    
        FactionStanding factions { papal_states } -0.8
    
    ;------------------------------------------
    Trigger 0058_P_Crusade_Attacks_Orthodox_General
    	WhenToTest GeneralAssaultsGeneral
    	
    	Condition IsOnCrusade
    			  and TargetFactionReligion orthodox
    	
    	FactionStanding factions { papal_states } -0.4
    
    ;------------------------------------------
    ;Trigger 0059_P_Crusade_Attacks_Orthodox_Residence
    ;	WhenToTest GeneralAssaultsResidence
    ;	
    ;	Condition IsOnCrusade
    ;			  and TargetFactionReligion orthodox
    ;	
    ;	FactionStanding factions { papal_states } -0.4
    
    	
    ;;;;;;;;;;;;;;;;
    ;; CHARACTERS ;;
    ;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0030_P_Recruit_Priest_Papal
        WhenToTest AgentCreated
    
        Condition TrainedAgentType = priest
            and FactionReligion catholic
    
        FactionStanding factions { papal_states } 0.02
    
    ;------------------------------------------
    Trigger 0031_P_Faction_Excommunicated
        WhenToTest FactionExcommunicated
    
        FactionStanding factions { papal_states } -1.0
    
    
    
    ;;;;;;;;;;;;;;
    ;; MISSIONS ;;
    ;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0100_Success_Pope_Min_Reward_Only
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_min_reward_only
    	
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0101_Success_Pope_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_min_penalty_min_reward
    	
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0102_Success_Pope_Mod_Penalty_Min_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_mod_penalty_min_reward
    	
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0103_Success_Pope_Rome_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_rome_min_penalty_min_reward
    
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0104_Success_Pope_Cardinal_Mod_Penalty_Min_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_mod_penalty_min_reward
    
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0104_Success_Pope_Cardinal_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_min_penalty_min_reward
    
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0105_Success_Pope_Mod_Reward_Only
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_mod_reward_only
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0106_Success_Pope_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0107_Success_Pope_Rome_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_rome_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0108_Success_Pope_Cardinal_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0109_Success_Pope_Cardinal_Mod_Reward_Only
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_mod_reward_only
    
        FactionStanding factions { papal_states } 0.2
    
    ;------------------------------------------
    Trigger 0110_Success_Pope_Major_Reward_Only
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_major_reward_only
    
        FactionStanding factions { papal_states } 0.4
    
    ;------------------------------------------
    Trigger 0111_Success_Pope_Rome_Min_Penalty_Major_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_rome_min_penalty_major_reward
    
        FactionStanding factions { papal_states } 0.4
    
    ;------------------------------------------
    Trigger 0112_Success_Pope_Cardinal_Major_Reward_Only
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_major_reward_only
    
        FactionStanding factions { papal_states } 0.4
    
    ;------------------------------------------
    Trigger 0113_Success_Pope_Cardinal_Min_Penalty_Major_Reward
        WhenToTest LeaderMissionSuccess
    
        Condition PaybackID pope_cardinal_min_penalty_major_reward
    
        FactionStanding factions { papal_states } 0.4
    
    ;------------------------------------------
    Trigger 0120_Fail_Pope_Min_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_min_penalty_only
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0121_Fail_Pope_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_min_penalty_min_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0122_Fail_Pope_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0123_Fail_Pope_Rome_Min_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_min_penalty_only
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0124_Fail_Pope_Rome_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_min_penalty_min_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0125_Fail_Pope_Rome_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0126_Fail_Pope_Rome_Min_Penalty_Major_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_min_penalty_major_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0127_Fail_Pope_Cardinal_Min_Penalty_Min_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_min_penalty_min_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0128_Fail_Pope_Cardinal_Min_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_min_penalty_only
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0129_Fail_Pope_Cardinal_Min_Penalty_Mod_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_min_penalty_mod_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0130_Fail_Pope_Cardinal_Min_Penalty_Major_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_min_penalty_major_reward
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0131_Fail_Pope_Mod_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_mod_penalty_only
    
        FactionStanding factions { papal_states } -0.15
    
    ;------------------------------------------
    Trigger 0132_Fail_Pope_Mod_Penalty_Min_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_mod_penalty_min_reward
    
    
        FactionStanding factions { papal_states } -0.15
    ;------------------------------------------
    Trigger 0133_Fail_Pope_Rome_Mod_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_mod_penalty_only
    
        FactionStanding factions { papal_states } -0.15
    
    ;------------------------------------------
    Trigger 0134_Fail_Pope_Cardinal_Mod_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_mod_penalty_only
    
        FactionStanding factions { papal_states } -0.15
    
    ;------------------------------------------
    Trigger 0135_Fail_Pope_Cardinal_Mod_Penalty_Min_Reward
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_cardinal_mod_penalty_min_reward
    
        FactionStanding factions { papal_states } -0.15
    
    ;------------------------------------------
    Trigger 0136_Fail_Pope_Major_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_major_penalty_only
    
        FactionStanding factions { papal_states } -0.3
    
    ;------------------------------------------
    Trigger 0137_Fail_Pope_Rome_Major_Penalty_Only
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID pope_rome_major_penalty_only
    
        FactionStanding factions { papal_states } -0.5
    
        
    
    ;;;;;;;;;;;;;;;
    ;; DIPLOMACY ;;
    ;;;;;;;;;;;;;;;
    
    
    ;------------------------------------------
    Trigger 0033_P_Give_Money
        WhenToTest GiveMoney
    
        Condition  TargetFactionType papal_states
    	  and  DiplomaticStanceFromFaction papal_states < AtWar
    
        FactionStanding factions { papal_states } amount 50 0.002
    
    
    ;------------------------------------------
    Trigger 0034_P_Give_Settlement
        WhenToTest GiveSettlement
    
        Condition  TargetFactionType papal_states
    	  and  DiplomaticStanceFromFaction papal_states < AtWar
    
        FactionStanding factions { papal_states } income 1000 0.06
    
    
    ;------------------------------------------
    Trigger 0035_P_Give_Rome
        WhenToTest GiveSettlement
    
        Condition  TargetFactionType papal_states
              and  SettlementName Rome
    	  and  DiplomaticStanceFromFaction papal_states < AtWar
    
        FactionStanding factions { papal_states } 0.6
    
    
    ;------------------------------------------
    Trigger 0036_P_Alliance_Declared
        WhenToTest FactionAllianceDeclared
    
        Condition  TargetFactionType papal_states
    
        FactionStanding factions { papal_states } 0.4
    
    
    ;------------------------------------------
    Trigger 0037_P_Break_Alliance
        WhenToTest FactionBreakAlliance
    
        Condition  TargetFactionType papal_states
    
        FactionStanding factions { papal_states } -0.6
    
    
    ;------------------------------------------
    Trigger 0038_P_Successful_Diplomacy
        WhenToTest DiplomacyMission
    
        Condition MissionSucceeded
              and TargetFactionType papal_states
    
        FactionStanding factions { papal_states } 0.05
    
    ;------------------------------------------
    Trigger 0039_P_War_Declared
        WhenToTest FactionWarDeclared
    
        Condition  TargetFactionType papal_states
    
        FactionStanding factions { papal_states } -0.5
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; CARDINALS AND ELECTIONS ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ;------------------------------------------
    Trigger 0040_P_Cardinal_Promoted
        WhenToTest CardinalPromoted
    
        FactionStanding factions { papal_states } 0.1
    
    ;------------------------------------------
    Trigger 0041_P_Cardinal_Removed
        WhenToTest CardinalRemoved
    
        FactionStanding factions { papal_states } -0.1
    
    ;------------------------------------------
    Trigger 0042_P_Own_Pope_Elected
        WhenToTest PopeElected
    
        Condition FactionEqualsTarget
    
        FactionStanding factions { papal_states } 0.8
    
    ;------------------------------------------
    Trigger 0043_P_Allied_Pope_Elected
        WhenToTest PopeElected
    
        Condition DiplomaticStanceWithNewPope = Allied
              and not FactionEqualsTarget
    
        FactionStanding factions { papal_states } 0.4
    
    ;------------------------------------------
    Trigger 0044_P_At_War_Pope_Elected
        WhenToTest PopeElected
    
        Condition DiplomaticStanceWithNewPope = AtWar
              and not FactionEqualsTarget
    
        FactionStanding factions { papal_states } -0.6
    
    ;------------------------------------------
    Trigger 0045_P_Voted_For_Pope
        WhenToTest VotedForPope
    
        FactionStanding factions { papal_states } 0.35
    
    
    ;;;;;;;;;;
    ;; MISC ;;
    ;;;;;;;;;;
    
    
    ;------------------------------------------
    Trigger 0046_P_Normalise
        WhenToTest FactionTurnStart
    
        FactionStanding factions { papal_states } normalise 0 50
    
    ;------------------------------------------
    Trigger 0047_P_Inquisitor_Appointed
        WhenToTest InquisitorAppointed
    
        FactionStanding factions { papal_states } -0.2
    
    ;------------------------------------------
    Trigger 0048_P_Assassin_Caught_Attacking_Pope
        WhenToTest AssassinCaughtAttackingPope
    
        FactionStanding factions { papal_states } -1.0
    
    ; Make the papal states dislike other religions
    ;------------------------------------------
    Trigger 0049_P_Normalise_Non_catholic
        WhenToTest FactionTurnStart
    
        Condition not FactionReligion catholic
    
        FactionStanding factions { papal_states } normalise -1 50
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; TRANSGRESSIONS AGAINST CATHOLICS ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0100_T_Invaded_Settlement
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_SETTLEMENT
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0101_T_Invaded_Fort
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_FORT
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.025
    
    ;------------------------------------------
    Trigger 0102_T_Invaded_Watchtower
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_WATCHTOWER
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.0125
    
    ;------------------------------------------
    Trigger 0103_T_Declared_War
        WhenToTest Transgression
    
        Condition TransgressionName = TC_DECLARED_WAR
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0104_T_Instigate_Siege
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INSTIGATE_SIEGE
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0105_T_Threaten_War
        WhenToTest Transgression
    
        Condition TransgressionName = TC_THREATEN_WAR
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.0125
    
    ;------------------------------------------
    Trigger 0106_T_Undeclared_Attack
        WhenToTest Transgression
    
        Condition TransgressionName = TC_UNDECLARED_ATTACK
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.05
    
    ;------------------------------------------
    Trigger 0107_T_INSTIGATE_ASSAULT
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INSTIGATE_ASSAULT
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.025
    
    ;------------------------------------------
    Trigger 0108_T_BLOCKADE
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BLOCKADE
    		and TargetFactionReligion catholic
    		and not TargetFactionExcommunicated
    
        FactionStanding factions { papal_states } -0.0125
    
        
      
    ;;;;;;;;;;;;;;;;;;;;
    ;; TRANSGRESSIONS ;;
    ;;;;;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0049_T_Attacking_Crusading_General
        WhenToTest Transgression
    
        Condition TransgressionName = TC_ATTACKING_CRUSADING_GENERAL
    
        FactionStanding target_religion normalise -1.0 10
    
    ;------------------------------------------
    Trigger 0050_T_Invaded_Fort
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_FORT
    
        FactionStanding target_faction normalise -1.0 10
        FactionStanding target_allies normalise -1.0 800
    
    ;------------------------------------------
    Trigger 0051_T_Stole_Back_Settlement
        WhenToTest Transgression
    
        Condition TransgressionName = TC_STOLE_BACK_SETTLEMENT
    
        FactionStanding global -1.0
        FactionStanding target_faction normalise -1.0 2
        FactionStanding target_allies normalise -1.0 20
    
    ;------------------------------------------
    Trigger 0052_T_Invaded_Settlement
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_SETTLEMENT
    
        FactionStanding target_faction normalise -1.0 5
        FactionStanding target_allies normalise -1.0 40
    
    ;------------------------------------------
    Trigger 0053_T_Invaded_Watchtower
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVADED_WATCHTOWER
    
        FactionStanding target_faction normalise -1.0 20
        FactionStanding target_allies normalise -1.0 80
    
    ;------------------------------------------
    Trigger 0055_T_Invasion_Neutral
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVASION
            and not DiplomaticStanceFactions = Allied
    
        FactionStanding target_faction normalise -1.0 50
    
    ;------------------------------------------
    Trigger 0055a_T_Invasion
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INVASION
            and DiplomaticStanceFactions = Allied
    
        FactionStanding target_faction normalise -1.0 100
    
    ;------------------------------------------
    Trigger 0055b_T_Invasion_Flee
        WhenToTest Transgression
    
        Condition TransgressionName = TC_FLEE_INVASION
    
        FactionStanding target_faction normalise -1.0 200
    
    ;------------------------------------------
    Trigger 0055c_T_Invasion_Crusade
        WhenToTest Transgression
    
        Condition TransgressionName = TC_CRUSADE_INVASION
    		and FactionReligion catholic
    		and not TargetFactionReligion catholic
    		and not TargetFactionReligion orthodox
    
        FactionStanding target_faction normalise -1.0 50
        FactionStanding target_religion normalise -1.0 200
    
    ;------------------------------------------
    Trigger 0055d_T_Invasion_Jihad
        WhenToTest Transgression
    
        Condition TransgressionName = TC_CRUSADE_INVASION
    		and FactionReligion islam
    		and not TargetFactionReligion islam
    
        FactionStanding target_faction normalise -1.0 50
        FactionStanding target_religion normalise -1.0 200
    
    ;------------------------------------------
    Trigger 0056_T_Nullified_Alliance
        WhenToTest Transgression
    
        Condition TransgressionName = TC_NULLIFIED_ALLIANCE
    
        FactionStanding global -0.05
        FactionStanding target_faction normalise -0.4 5
        FactionStanding target_allies normalise -0.2 20
        FactionStanding target_enemies normalise 1.0 20
    
    ;------------------------------------------
    Trigger 0057_T_Broke_Treaty_terms
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BROKE_TREATY_TERMS
    
        FactionStanding global -0.15
        FactionStanding target_faction normalise -0.25 5
        FactionStanding target_allies normalise -0.25 40
    
    ;------------------------------------------
    ;Trigger 0058_T_Diplomatic_Insult	; fired for every 1000 gold diplomacy proposal under balanced - 1
    ;    WhenToTest Transgression
    ;
    ;    Condition TransgressionName = TC_DIPLOMATIC_INSULT
    ;
    ;    FactionStanding target_faction -0.001
    
    ;------------------------------------------
    Trigger 0059_T_Dishonour
        WhenToTest Transgression
    
        Condition TransgressionName = TC_DISHONOUR
    
        FactionStanding target_faction normalise -0.8 10
        FactionStanding target_allies normalise -0.8 40
    
    ;------------------------------------------
    Trigger 0060_T_Declared_War
        WhenToTest Transgression
    
        Condition TransgressionName = TC_DECLARED_WAR
    
        FactionStanding target_faction normalise -0.8 4
        FactionStanding target_allies normalise -0.8 20
        FactionStanding target_enemies normalise 0.6 20
    
    ;------------------------------------------
    Trigger 0061_T_Major_Assassination_Attempt
        WhenToTest Transgression
    
        Condition TransgressionName = TC_MAJOR_ASSASSINATION_ATTEMPT
    
        FactionStanding target_faction normalise -0.8 5
        FactionStanding target_allies normalise -0.8 40
    
    ;------------------------------------------
    Trigger 0062_T_Minor_Assassination_Attempt
        WhenToTest Transgression
    
        Condition TransgressionName = TC_MINOR_ASSASSINATION_ATTEMPT
    
        FactionStanding target_faction normalise -0.4 20
        FactionStanding target_allies normalise -0.4 80
    
    ;------------------------------------------
    Trigger 0063_T_Sabotage
        WhenToTest Transgression
    
        Condition TransgressionName = TC_SABOTAGE
    
        FactionStanding target_faction normalise -0.4 5
        FactionStanding target_allies normalise -0.4 40
    
    ;------------------------------------------
    Trigger 0064_T_Bribed_Away_Army
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BRIBED_AWAY_ARMY
    
        FactionStanding target_faction normalise -0.5 10
    
    ;------------------------------------------
    Trigger 0065_T_Bribed_Away_Character
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BRIBED_AWAY_CHARACTER
    
        FactionStanding target_faction normalise -0.7 5
    
    ;------------------------------------------
    Trigger 0066_T_Bribed_Away_Settlement
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BRIBED_AWAY_SETTLEMENT
    
        FactionStanding global -0.15
        FactionStanding target_faction normalise -0.8 5
    
    ;------------------------------------------
    Trigger 0067_T_Bribed_Away_Fort
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BRIBED_AWAY_FORT
    
        FactionStanding target_faction normalise -0.75 10
    
    ;------------------------------------------
    Trigger 0068_T_Battle_Engagement
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BATTLE_ENGAGEMENT
            and not TargetFactionType slave
    
        FactionStanding target_faction normalise -0.8 10
        FactionStanding target_allies normalise -0.6 80
        FactionStanding target_enemies normalise 0.4 80
    
    ;------------------------------------------
    Trigger 0069_T_Instigate_Siege
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INSTIGATE_SIEGE
    
        FactionStanding target_faction normalise -1.0 5
        FactionStanding target_allies normalise -0.8 40
    
    ;------------------------------------------
    Trigger 0070_T_Spying
        WhenToTest Transgression
    
        Condition TransgressionName = TC_SPYING
    
        FactionStanding target_faction normalise -0.2 20
        FactionStanding target_allies normalise -0.1 80
    
    ;------------------------------------------
    Trigger 0071_T_Threaten_War
        WhenToTest Transgression
    
        Condition TransgressionName = TC_THREATEN_WAR
    
        FactionStanding target_faction normalise -0.6 5
    
    ;------------------------------------------
    Trigger 0072_T_Undeclared_Attack
        WhenToTest Transgression
    
        Condition TransgressionName = TC_UNDECLARED_ATTACK
    
        FactionStanding target_faction normalise -1.0 5
        FactionStanding target_allies normalise -0.8 40
    
    ;------------------------------------------
    Trigger 0072_T_Undeclared_Attack_Withdraw
        WhenToTest Transgression
    
        Condition TransgressionName = TC_UNDECLARED_ATTACK_WITHDRAW
    
        FactionStanding target_faction normalise -0.6 10
        FactionStanding target_allies normalise -0.4 80
    
    ;------------------------------------------
    Trigger 0073_T_INSTIGATE_ASSAULT
        WhenToTest Transgression
    
        Condition TransgressionName = TC_INSTIGATE_ASSAULT
    
        FactionStanding target_faction normalise -0.75 5
        FactionStanding target_allies normalise -0.6 40
    
    ;------------------------------------------
    Trigger 0074_T_BLOCKADE
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BLOCKADE
    
        FactionStanding target_faction normalise -0.5 5
        FactionStanding target_allies normalise -0.25 40
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; DISHONEST TRANSGRESSIONS ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0078b_DT_Break_Alliance_War
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BROKE_ALLIANCE
            and DiplomaticStanceFactions = AtWar
    
        FactionStanding global -0.2
        FactionStanding target_faction normalise -1.0 5
        FactionStanding target_allies normalise -0.8 20
    
    ;------------------------------------------
    Trigger 0078c_DT_Break_Alliance_Neutral
        WhenToTest Transgression
    
        Condition TransgressionName = TC_BROKE_ALLIANCE
            and DiplomaticStanceFactions = Neutral
    
        FactionStanding global -0.05
        FactionStanding target_faction normalise -0.8 10
        FactionStanding target_allies normalise -0.5 40
    
    
    
    
    ;;;;;;;;;;;;;;;;;
    ;; FORGIVENESS ;;
    ;;;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0079_F_Trade_Agreement
        WhenToTest FactionTradeAgreementMade
    
        FactionStanding target_faction 0.05
        FactionStanding target_allies normalise 0.6 50
    
    ;------------------------------------------
    Trigger 0080_F_Military_Assistance
        WhenToTest Forgiveness
    
        Condition ForgivenessName = FC_MILITARY_ASSISTANCE
    
        FactionStanding global 0.2
        FactionStanding target_faction 0.4
        FactionStanding target_allies normalise 1.0 20
    
    ;------------------------------------------
    Trigger 0081_F_Obvious_Bribe	; fired for every 1000 gold given as gift
        WhenToTest Forgiveness
    
        Condition ForgivenessName = FC_OBVIOUS_BRIBE
    
        FactionStanding target_faction normalise 0.5 50
    
    ;------------------------------------------
    ;Trigger 0082_F_Update_Attitude
    ;    WhenToTest UpdateAttitude
    ;
    ;    Condition FactionStanding > 0.0
    ;
    ;    FactionStanding target_faction 0.01
    
    ; Forming an alliance increases relationships (papal states already factored in above)
    ;------------------------------------------
    Trigger 0082b_F_Alliance_Declared
        WhenToTest FactionAllianceDeclared
    
        Condition not TargetFactionType papal_states
    
        FactionStanding target_faction 0.4
        FactionStanding target_allies normalise 0.4 50
    
    ; Inter faction marriage increases relationships
    ;------------------------------------------
    Trigger 0082c_P_Faction_Marriage
        WhenToTest InterFactionMarriage
    
        FactionStanding target_faction 0.4
    
    
    
    ;;;;;;;;;;;;;;;
    ;; DEMEANOUR ;;
    ;;;;;;;;;;;;;;;
    
    ;------------------------------------------
    Trigger 0083_Demeanour
        WhenToTest Demeanour
    
        FactionStanding target_faction amount 1.0 0.005
        FactionStanding target_allies amount 1.0 0.001
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;
    ;; AI Relationships ;;
    ;;;;;;;;;;;;;;;;;;;;;;
    
    
    ; Make allied factions like us a bit more
    ;------------------------------------------
    Trigger 0083b_Update_Allies
        WhenToTest FactionTurnStart
    
        FactionStanding allies normalise 0.8 50
    
    
    ; Make enemy factions like us a bit less
    ;------------------------------------------
    Trigger 0084b_Update_Enemies
        WhenToTest FactionTurnStart
    
        Condition not FactionType slave
    
        FactionStanding enemies normalise -0.8 20
    
    
    ; Make allies of our allies like us a bit more
    ;------------------------------------------
    Trigger 0083c_Update_Allies_Allies
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = Allied
    
        FactionStanding target_allies normalise 0.8 100
    
    
    ; Make enemies of our allies like us a bit less
    ;------------------------------------------
    Trigger 0084c_Update_Allies_Enemies
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = Allied
    
        FactionStanding target_enemies normalise -0.8 100
    
    
    ; Make allies of our enemies like us a bit less
    ;------------------------------------------
    Trigger 0083d_Update_Enemies_Allies
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = AtWar
    
        FactionStanding target_allies normalise -0.8 100
    
    
    ; Make enemies of our enemies like us a bit more
    ;------------------------------------------
    Trigger 0084d_Update_Enemies_Enemies
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = AtWar
              and not TargetFactionType slave
    
        FactionStanding target_enemies normalise 0.8 150
    
    
    ; Make other Catholic factions like the pope a bit more
    ;------------------------------------------
    Trigger 0084_Update_Papal
        WhenToTest FactionTurnStart
    
        Condition FactionType Papal_States
    
        FactionStanding own_religion normalise 1.0 50
    
    
    ; Make other factions like factions of the same religion a bit more
    ;------------------------------------------
    Trigger 0085_Update_Religion
        WhenToTest FactionTurnStart
    
        FactionStanding own_religion normalise 1.0 100
    
    
    ; Make factions get a case of the 'tall poppy' syndrome.  get narky about the larger factions
    ;------------------------------------------
    Trigger 0086_Update_Tall_Poppy1
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall > 90
            and FactionScoreRank overall <= 1
    
        FactionStanding exclude_factions { } normalise -1.0 90
    
    ;------------------------------------------
    Trigger 0087_Update_Tall_Poppy2
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall > 80
            and FactionScoreRank overall <= 3
    
        FactionStanding exclude_factions { } normalise -1.0 135
    
    ;------------------------------------------
    Trigger 0088_Update_Tall_Poppy3
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall > 70
            and FactionScoreRank overall <= 5
    
        FactionStanding exclude_factions { } normalise -1.0 180
    
    
    ; Make factions try and band up with smaller factions
    ;------------------------------------------
    Trigger 0089_Update_Band_Together1
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall < 30
            and FactionScoreRank overall > 3
    
        FactionStanding exclude_factions { } normalise 1.0 40
    
    ;------------------------------------------
    Trigger 0090_Update_Band_Together2
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall < 20
            and FactionScoreRank overall > 4
    
        FactionStanding exclude_factions { } normalise 1.0 25
    
    ;------------------------------------------
    Trigger 0091_Update_BandTogether3
        WhenToTest FactionTurnStart
    
        Condition FactionHasRank
            and FactionScorePercent overall < 10
            and FactionScoreRank overall > 5
    
        FactionStanding exclude_factions { } normalise 1.0 10
    
    
    ; Adjust the AI relationships towards each faction based on difficulty level (AI factions have normal difficulty)
    ;------------------------------------------
    Trigger 0092_Update_Easy_Difficulty
        WhenToTest FactionTurnStart
    
        Condition CampaignDifficulty = easy
    
        FactionStanding exclude_factions { } normalise 1.0 50
    
    ;------------------------------------------
    Trigger 0093_Update_Normal_Difficulty
        WhenToTest FactionTurnStart
    
        Condition CampaignDifficulty = medium
    
        FactionStanding exclude_factions { } normalise 0.0 50
    
    ;------------------------------------------
    Trigger 0094_Update_Hard_Difficulty
        WhenToTest FactionTurnStart
    
        Condition CampaignDifficulty = hard
    
        FactionStanding exclude_factions { } normalise 0.0 50
    
    ;------------------------------------------
    Trigger 0095_Update_Very_Hard_Difficulty
        WhenToTest FactionTurnStart
    
        Condition CampaignDifficulty = very_hard
    
        FactionStanding exclude_factions { } normalise -0.5 50
    
    ;------------------------------------------
    Trigger 0096_Increase_Global_Standing_New_Turn
        WhenToTest FactionTurnStart
    
        FactionStanding global normalise 0.05 200
    
    ;------------------------------------------
    Trigger 0097_Increase_Global_Standing_When_Allied
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = Allied
    
        FactionStanding global normalise 1.0 300
    
    ;------------------------------------------
    Trigger 0098_Decrease_Global_Standing_When_War
        WhenToTest UpdateAttitude
    
        Condition DiplomaticStanceFactions = AtWar
            and not TargetFactionType slave
    
        FactionStanding global normalise -1.0 800
    
    
    
    ;------------------------------------------
    Trigger 0099_prisoners_released_increase_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType release
              and NumCapturedSoldiers > 80
    
        FactionStanding global 0.03
        FactionStanding target_faction normalise 0.8 20
        FactionStanding target_allies normalise 0.6 40
    
    ;------------------------------------------
    Trigger 0100_prisoners_executed_decrease_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType execute
              and NumCapturedSoldiers > 80
    
        FactionStanding global -0.025
        FactionStanding target_faction normalise -0.8 20
        FactionStanding target_allies normalise -0.6 40
    
    ;------------------------------------------
    Trigger 0099b_prisoners_released_increase_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType release
    
        FactionStanding global 0.01
        FactionStanding target_faction normalise 1.0 80
        FactionStanding target_allies normalise 1.0 160
    
    ;------------------------------------------
    Trigger 0100b_prisoners_executed_decrease_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType execute
    
        FactionStanding global -0.01
        FactionStanding target_faction normalise -1.0 80
        FactionStanding target_allies normalise -1.0 160
    
    ;------------------------------------------
    Trigger 0099c_characters_released_increase_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType release
              and NumCapturedCharacters > 0
    
        FactionStanding global 0.05
        FactionStanding target_faction normalise 1.0 20
        FactionStanding target_allies normalise 1.0 40
    
    ;------------------------------------------
    Trigger 0100c_characters_executed_decrease_global
        WhenToTest FactionLeaderPrisonersRansomedCaptor
    
        Condition RansomType execute
              and NumCapturedCharacters > 0
    
        FactionStanding global -0.05
        FactionStanding target_faction normalise -1.0 20
        FactionStanding target_allies normalise -1.0 40
    
    ;------------------------------------------
    Trigger 0101_sack_settlement_decrease_global
        WhenToTest SackSettlement
    
        FactionStanding global -0.01
        FactionStanding target_faction normalise -1.0 40
        FactionStanding target_allies normalise -1.0 80
    ;    FactionStanding target_enemies normalise 1.0 80
    
    ;------------------------------------------
    Trigger 0102_extermination_decrease_global
        WhenToTest ExterminatePopulation
    
        FactionStanding global -0.04
        FactionStanding target_faction normalise -1.0 20
        FactionStanding target_allies normalise -1.0 40
    ;    FactionStanding target_enemies normalise 1.0 40
    
    ;------------------------------------------
    Trigger 0103_occupy_settlement_increase_global
        WhenToTest OccupySettlement
    
        FactionStanding global 0.05
        FactionStanding target_faction normalise 1.0 20
        FactionStanding target_allies normalise 1.0 40
    ;    FactionStanding target_enemies normalise -1.0 40
    
    ;------------------------------------------
    ;Trigger 0102_city_razed_decrease_global
    ;    WhenToTest CitySacked
    
        FactionStanding global -0.05
        FactionStanding target_faction normalise -1.0 10
        FactionStanding target_allies normalise -1.0 20
    ;    FactionStanding target_enemies normalise 1.0 20
    
    ; make all other factions hate the rebels
    ;------------------------------------------
    Trigger 0103_Update_Slaves
        WhenToTest FactionTurnStart
    
        Condition FactionType slave
    
        FactionStanding exclude_factions { } normalise -1.0 1
    
    ; make slaves hate all other factions
    ;------------------------------------------
    ;Trigger 0104_Update_Slaves_Reverse
    ;    WhenToTest UpdateAttitude
    ;
    ;    Condition Not FactionType slave
    ;	and TargetFactionType slave
    ;
    ;    FactionStanding target_faction normalise -1.0 1
    
    ; make factions like trustworthy factions more
    ;---------------------------------------------
    Trigger 0105_Update_Trustworthy_Factions_Major
        WhenToTest FactionTurnStart
    
        Condition GlobalStanding > 0.4
    
        FactionStanding exclude_factions { } normalise 1.0 40
    
    Trigger 0106_Update_Trustworthy_Factions_Minor
        WhenToTest FactionTurnStart
    
        Condition GlobalStanding > 0.1
    
        FactionStanding exclude_factions { } normalise 1.0 80
    
    ; make factions like untrustworthy factions less
    ;---------------------------------------------
    Trigger 0107_Update_Untrustworthy_Factions_Major
        WhenToTest FactionTurnStart
    
        Condition GlobalStanding < -0.4
    
        FactionStanding exclude_factions { } normalise -1.0 40
    
    Trigger 0108_Update_Untrustworthy_Factions_Minor
        WhenToTest FactionTurnStart
    
        Condition GlobalStanding < 0.1
    
        FactionStanding exclude_factions { } normalise -1.0 80
    
    ; make existing inter faction marriages improve relationships
    ;---------------------------------------------
    Trigger 0109_Update_Marriages
        WhenToTest UpdateAttitude
    
        Condition NumFactionMarriages > 0
    
        FactionStanding target_faction normalise 1.0 20

  23. #83

    Default Re: Campaign/Diplomacy AI

    the army to army ratio i think is a good line to mess with although i havnt tinkered with it much. i understand the thinking behind it is because according to the military art a ratio of 5 to 1 is considered appropriate when attacking another country.

    what will changing the can force invade to true do?

    are the decision entries for invading a province related to individual armies or all the armies in that province?

    what is the definition of front line strength?

    is it the total of the units in a said province or are they the total number of units in close proximity to the enemy ai?

  24. #84

    Default Re: Campaign/Diplomacy AI

    military art a ratio of 5 to 1 is considered appropriate when attacking another country.
    You can do that, and the AI would build impresive armies that would probably do nothing, and would definately do nothing in battle. Anythong much over 1:1 tends to cause unreasonable passivity in battle. Also note Lusted's post, even a 1.2 caused expansion dificulties for the AI on the campaign level. I've not got Kingdoms yet, but I've been told it has, in the descr_campaign_db.xml a line like

    <att_str_modifier float="0.8"/> <!-- modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->

    Which may be more forgiving to larger numbers, though seeing where the default is the same it's doubtfull.

    are the decision entries for invading a province related to individual armies or all the armies in that province?
    Decision entries in the ai_db refer to a faction wide balance depending on what balance your using. When deciding whether to attack or not based on the army strength ratio it only consideres the target stack, disregarding even adjacent armies, on the up side the AI dose prefer to target the strongest single stack in the vacinity and match it's strength accordingly.

    For the other questions refer to the link in the title post, you'll find probably the best explanation of force invade and frontline balance as you can find anywhere. As for whether it considers all units in a province or in the vacinity I'm not sure, though I belive it's distance related with the 'strength' of any given army reduced the further from the actual border it is, what province they are in is meaningles. I think this is why having troops onboard navies messes up the frontline balance, because the program is not designd to consider naval distances (thus also the constant troop loss when crusading armies are onboard a fleet regardless of how much closer you are to the target.) This is all just theory and speculation based on study of the LTGD log though if anyone dose KNOW how it works they are not forthcoming with the info.

  25. #85

    Default Re: Campaign/Diplomacy AI

    ive been tweaking the campaign ai db and im still not seeing the ai turn really agressive.

    if i went by a routine that the ai goes through i would never win.

    a losing nation will only lose more if it will never fight battles and take risks. and the ai will not take risk and therefore will lose.

    also i wonder if there is something that keeps the ai from finishing off the human opponent. they seem to do a good job of wasting each other but ive never seen an all out concerted attempt to knock me out of the game.

    does this have something to do with the command lines pertaining to the faction not outliving the target faction?

    i also noticed several lines in the campaign ai db where the ai would not attack another faction or factions until a certian number of turns expired. this is used at the first of the game where i think only rebels are targeted for the first 10 turns. i set this to 0 but im still not expecting much.

    im beginning to figure out that the devs intended to make the ai not very aggressive so an inexperienced player would not get demolished. however i would have thought that would be what the easy settings are for.

    there does not appear to be a drastic increase of aggression between minimum entries and maximum entries.

    im almost tempted to change the force_invade line to true, to see if the ai will get more aggressive.

    im beginning to wonder if most of the campaign ai is hardcoded and beyond modding.
    Last edited by pike master; 12-21-2007 at 06:07.

Page 3 of 3 FirstFirst 123

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