XCOM 2
AI Distributes Attacks [WOTC]
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.
Alex Nares  [author] 20 May, 2020 @ 1:58pm 
Enemies will only prefer high hp over low hp when choosing between the two - and even then, only if the scores are similar. If the only good targets are low hp, then they will still shoot normally. But also "easier" depends on what you consider to be easier. While there will be less soldiers deaths, you will have more wounded soldiers tied up in the infirmary. But regardless, the mod simply provides another option for anyone to customize their game.
EvilPolygons 20 May, 2020 @ 1:52pm 
Correct me if I'm wrong, but it seems like this would just make the game easier if the AI is specifically trying NOT to target wounded soldiers in favor of targeting guys at full health.
DerBK 20 May, 2020 @ 9:41am 
That is correct, that vanilla thing is only on low diff's.
Alex Nares  [author] 20 May, 2020 @ 9:40am 
I did notice that, but I think it only works when playing on Rookie or Veteran. The behavior check is labeled "IsDifficultyLow" and references difficulty=0 and difficulty=1. I would like for attacks to be distributed regardless of difficulty.
DerBK 20 May, 2020 @ 9:39am 
On another note... i suspect that ABA is the reason why you are seeing the enemy focus down your guys in the first place. Vanilla actually has a "spread your fire around" built in that ABA and ABAI deactivate... soooo .... yeah :D
Alex Nares  [author] 20 May, 2020 @ 9:38am 
That's good to know, now I know what to look for, thanks.
DerBK 20 May, 2020 @ 9:36am 
I am mostly referring to the "Priority Shots" which go past the normal targeting. They are Flankshot (enemy flanking your dude and having high chance to hit), Sureshot (enemy having very high chance to hit) and Killshot (enemy being able to kill your dude and having good chance to hit). Any unit that checks for one of these will use one of those targets if it can. If none applies, then regular targeting (and your changes) will take over.

I assume that the Killshot behavior is going to massively impact what you are trying to do here ;)
Alex Nares  [author] 20 May, 2020 @ 9:05am 
@DerBK
Thanks for letting me know. I did check ABA's AI to see how it would be impacted, and I noticed there are still references to "TargetScoreHealth" (which is a base behavior). I will have to check ABA's AI file again to see if I missed a new targeting behavior and get around that. Although, I do have ABA installed and during my testing with this mod, enemies were still noticably ignoring low HP soldiers in favor of higher HP ones when the shots were probably similar in score.

@The Rach
I couldn't have said it better myself, well done.

@Valvatorex @Arkhangel
Just to be clear, one of the factors IS based on accuracy. But it is only 1 component in the calculation. They do consider other factors such as HP, soldier rank, etc. It is still completely possible for them to make a kill shot when it's ideal (for example, when the soldier is easy to hit and there are no other good shots available).
Arkhangel 19 May, 2020 @ 11:57pm 
@DerBK: honestly shouldn't be based on HP amount though XD

Valv's right, should be based on accuracy. Which, ironically, would make them more likely to make kill shots, it's what we do.
The Rach 19 May, 2020 @ 10:40pm 
Imo it makes more sense this way. Its a battlefield, no one has time to cherry pick there targets. Actual fire fights function more like this, except at much farther distances lol. You see your enemy you shoot, even if you don't hit you've supressed them. I like this method more. It's not about sparing or humanitarianism its warfare, why would one throw all eggs into one basket to score one wounded guy in the back of the battle line? Snipers counter other snipers, as does artillery. Grenadiers anyone? The base AI makes no sense, why dump all your damage into one shmuck? Because the AI knows that in base game one death can set you back, its a meta game, whereas they should be wounding more of your guys than outright killing them. In modern war its shoot to wound not shoot to kill, a wounded enemy is a more costly one than an injured enemy
Valvatorez(Cox Cable = awful ISP 19 May, 2020 @ 10:30pm 
It's stupid that shooting priority is based on health instead of accuracy. Sometimes ADVENT will fire at injured soldiers hiding behind full cover on the high ground in full cover or Sharpshooters in the back line that they have no chance of hitting.
DerBK 19 May, 2020 @ 9:39pm 
"Should work with ABA and other AI mods"

Technically correct, but in practice this mod will not work with ABA very well. ABA circumvents the scored targeting in many spots to achieve the exact opposite of what you are doing. The AI in ABA is trained to finish off enemy soldiers, not spare them for humanitary reasons :)
The Rach 19 May, 2020 @ 9:26pm 
Man I love these mods. So simple yet adress so many issues with the game. I for one hated how with high squad counts and high enemy counts all 8 advent troopers would agro 1 guy to death lol. Keep making what your making, quality of life mods :)