XCOM 2
57 ratings
AI Distributes Attacks [WOTC]
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
702.439 KB
19 May, 2020 @ 7:59pm
22 May, 2020 @ 4:10pm
2 Change Notes ( view )

Subscribe to download
AI Distributes Attacks [WOTC]

Description
Enemies will be more likely to distribute their attacks and spread out the damage between different soldiers in your squad, and give more priority to targeting higher-HP soldiers (instead of lower-HP ones).

The default AI uses a target scoring point-system to evaluate which soldiers to shoot. This scoring system considers a large variety of factors and adds points for different things, such as Aim %, distance to target, flanked, etc. Whichever XCOM soldier was scored the highest, would get attacked.

One of the factors considered is how much HP the XCOM units have. The AI would previously try to prioritize lower HP soldiers to make kill shots whenever possible. The lower your soldiers' HP, the higher the chance they would get shot. The AI would even try to take difficult shots just for the possibility of a kill shot. <--- This is the default game.

This mod changes a series of score values so that high-HP soldiers will be a more attractive target for enemies. This will result in the AI distributing their attacks amongst your squad and giving a higher priority on shooting high-HP targets that can probably survive the attack if it hits.

These bonuses are not absolute however, it just gives more weight to higher HP - so the AI will not try to make an impossible shot on a high-HP soldier when there is an easy shot available on a lower HP soldier. This mod pretty much acts as a tie-breaker whenever most of the targets are similar in score to each other. (with maybe a little more importance on shooting high-HP targets)

This will also result in more soldiers wounded and recovering in the infirmary - but less soldier deaths.

--- Breakdown of Point Adjustment ---
Target is Killable = -15 (was +15)
Target has low HP = 0 (was +10)
Target is wounded = 0 (was +5)
Add to score x Max HP = 0 (was 10)
Add to score x Current HP = 10 (was 1) <-- This means 10 points for each 1 HP


100% safe to enable or disable any time. Should work with ABA and other AI mods - because this does not add any new AI behaviors - it just modifies base-game point values for target HP scoring and makes previous AI behaviors look at additional factors.

For another AI tweak, check out Less Enemy Spacing.
23 Comments
Alex Nares  [author] 29 Dec, 2020 @ 11:43pm 
I am not sure, I would have to check the INI code to see how it is written and decipher it. I did have conclusive results during testing though to verify that the AI is properly distributing attacks. Note that this mod only *influences* their target selection - it does not *override* it completely.
Thalioden 29 Dec, 2020 @ 9:19pm 
Since TargetScoreHealth_HighFirst and TargetScoreHealth are Selector Nodetypes, does that mean only the first true child node will be applied?
Creed 24 Sep, 2020 @ 7:29pm 
Makes sense, thanks for the clarification.
Alex Nares  [author] 23 Sep, 2020 @ 11:18pm 
Yes that is correct. However the default AI also weighs Soldier rank (more rank adds more points and preference to shoot). However, keep in mind that you are essentially "dumbing down" the AI. They will be less sophisticated and more predictable - most gamers will agree that a more sophisticated AI is "better".
Creed 23 Sep, 2020 @ 9:26pm 
I am curious, what would happen if I made all of the base score values zero? As in what would happen if the AI didnt weigh health at all? Would it just prioritize the highest chance to hit? If so wouldnt that potentially be the most dangerous? The AI isnt showing favorite to anything other than getting the best possible shot? If so I would like to do this
TachiKami 21 May, 2020 @ 6:23pm 
Nice one!
Alex Nares  [author] 21 May, 2020 @ 8:07am 
Yes, although if you are mid-mission, changes might not take effect until next mission.
EvilPolygons 21 May, 2020 @ 5:37am 
@Alex Nares:
Awesome, thanks. :steamhappy:
It should be safe to tinker around with the numbers mid-game, right?
Alex Nares  [author] 20 May, 2020 @ 5:12pm 
Yes, you can open the config file from the mod folder 268500\2102632326\Config\XComAI.ini.

Don't change anything on the lines with a minus ( - ) in front of it. Only change lines with a + in front of it. The scores are located under each parameter "AddToTargetScore". Be careful not to set any parameter too far into the negatives - because then it could completely invalidate targets and the AI absolutely WILL NOT attack them, ever.
EvilPolygons 20 May, 2020 @ 3:10pm 
@Alex Nares:
So in your mod, it seems that the AI won't waste turns trying to make impossible kill shots, but also prefers to avoid kill shots. I'm not really a fan of that last bit there.

I'd prefer that the AI continue to prioritize low HP/killable targets -- but only when the odds of landing a hit are equal to (or greater) than the odds of hitting any other available target. I think this would make the AI a lot more difficult and act more like a real human player.

Do you expose your mod settings in the ini file? I'd love to be able to tweak those numbers.