XCOM 2
265 ratings
[WOTC] Sniper Defense Fix
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.020 MB
3 Sep, 2018 @ 2:44pm
21 Sep, 2019 @ 3:52pm
6 Change Notes ( view )
You need DLC to use this item.

Subscribe to download
[WOTC] Sniper Defense Fix

In 2 collections by RedDobe
V5.3 RedDobe Challenging Gameplay
213 items
RedDobe V6.0 (Everything you need for a unique fresh campaign)
251 items
Description
Tired of how is easy it is to cheese the enemy AI when you have a concealed unit and sniper combo? Tired of units running right back to the same spot in the open where they were just shot or teammate was killed? Well, so am I! This mod attempts to resolve that problem by adding a new "Sniper Defense" selector in the behavior tree for enemies.

It works by adding a sniper defense selector in the Generic Alert Handler for Yellow alerts, which is where the problem lies. I use a trigger to select this sniper defense behavior only when the following are true:
1. There are no visible enemies to the unit
2. The Alert (Sniper Location) is more than 24 tiles away
3. One of the units in the pod took damage or if the shot is missed there is a 50% chance to alert the pod (This is configurable in the XcomSniperDefense.ini file.
4. The pod has not had any prior knowledge of your team
5. The alert is not older than 5 turns

When you have a sniper shooting an enemy unit with a concealed spotter, the enemy pod will now advanced towards the sniper fire using cover, instead of running in circles.

Safe to add and remove anytime as this only modifies the TrySelectYellowAlertAction behavior in the XcomAI.ini Behavior tree, which is a branch of the Generic Yellow Movement, which is a branch of the Generic Alert Handler.

All new Alien and AI mods that I am aware of use this same generic alert handler for their behaviors, so it should be compatable with every mod, especially ABA ( I made sure of this prior to creating the mod).
61 Comments
RedDobe  [author] 24 Jul @ 5:26pm 
What a coincidence! Glad that you worked it out.
BlackDog 20 Jul @ 11:38pm 
I looked into this some more this morning - basically the alien pack sniper defense is just hooked into the scamper-root for the naja, while the 'sniper defense' mod adds the behaviour into the alert handler for all units, so me just renaming the AI nodes in the pack is the safer option. I've therefore pushed an update this morning which should resolve the conflict. I can't say for sure which behaviour will take precedence when you alert a naja unit because I don't know whether the alert handler or unit scamper takes precedance but in any case, the behaviours are virtually identical anyway so there shouldn't be any obvious difference in gameplay terms.
Dragon32 25 Jun @ 12:33pm 
@RedDobe
OK, thanks mate. I'll mess around with that now I'm back from holiday. Apparently it's a behaviour just used by the Naja enemy from that mod. FYI, the scoring behaviour in this mod has
AddToAlertDataScore_-100
and that
AddToAlertDataScore_100

So not sure which version of the behaviour would actually take effect but if it's that one it looks to an amateur like it'd break this mod.
RedDobe  [author] 25 Jun @ 10:47am 
It sounds like the same ai behavior name was used. You would just have to negate the behavior and rename it.
Dragon32 19 Jun @ 10:15am 
I'm getting a Redscreen error about a duplicate behaviour with this mod and BlackDog's Standalone LWOTC Alien Pack mod .

BehaviorTable index 4693 has a duplicate name (ScoreSniperFire) - INVALID

Looking at the two XcomAI.ini files makes me wonder if that mod incorporates this mod's functionality. I'm not the best at parsing AI behaviours but they sure seem to be using similar names and values.
Dragon32 10 May @ 8:38am 
no worries
Phoenix 9 May @ 5:27pm 
@Dragon32 Ok, thanks again man.
Dragon32 9 May @ 7:02am 
@Phoenix
I use both. AFAIK this will alert if units in a pod are damaged, the other mod when objectives are
Phoenix 8 May @ 5:48pm 
With this mod I wouldn't need the Anti Relay Cheese [WOTC] mod anymore right? This mod would do the same thing but better right?
RedDobe  [author] 10 Jun, 2023 @ 5:24pm 
Oh I see. Yes it would bring them towards avenger.