-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow mods to adjust AI behaviour of AoE profiles to specifically exclude lost units #1369
Comments
Does this have a use case? |
Yes, basically to stop grenadiers, rocketeers and modded units with AoE AI profiles from firing explosives at big groups of lost and prioritising XCOM soldiers. I'd like to implement it on the AoE profiles in my alien pack, for one thing but it would be a useful nice-to-have across the board I think, being able to just set a flag in the AI config and have AoE abilities not count lost units for targetting purposes (e.g. Must have max 2 non-lost units to target this area or w.e.) |
Seems like a legitimate use of AOE abilities though? |
Well, grenadiers flashbanging lost is pretty weird, as is vipers using posion spit on them (giving they are immune to both). Perhaps it could be gotten around by using bTestTargetEffectsApply in the AI, or with specific conditions applied on the abilities via OPTC or something but the test-target-effects check looks pretty janky in the source. Generally, I think it would be nice for modders to have more choice/control to exclude them from the targetting arrays but I'm open to alternative suggestions. |
Fair enough |
Since RJ has suggested that the proposed commit is a bit iffy - are there other implementations that might work? For example, there is an X2Condition in LWOTC
Would putting such an X2_Condition on the ability, along with setting bTestTargetEffectsApply in the XGAIBehaviour be enough to have the same effect? |
I don't really know how AI works. |
Just been doing a little more testing on this issue. Whilst it's not related to 'specifically' excluding lost from AOE profiles, there is a (at least one) bug in XGAIBehavior::GetAllAOETargets which is short circuiting the check for whether targets are immune to the effects AOE abilities, if bTestTargetEffectsApply is set on the AOE Targeting Profile in the AI.
And here is the output of a custom poison spit ability from one of the Vipers in the LWOTC Alien pack (I set bTestTargetEffectsApply on all of the AOE profiles on the AI in my pack as a contingency): As you can see, because bValid is not set back to false at the start of the For loop, if it finds one unit that isn't immune to the effects, it considers every other target in the AOE as not immune as well. As a minimum, if we re-set this to false, it will make AOE profiles with TestTargetEffectsApply somewhat better. However I think there may be other ways that the check can be circumvented as well.
|
Yeah fixing this seems reasonable. |
Currently, XGAIBehaviour does not have any specific means of excluding lost units from AoE targetting profiles. Setting bTargetTheLost in XComAI.ini allows units to explicitly include lost for abilities which wouldn't otherwise (this is only set for Harbor Wave and purifier flamethrower in the base game) but there is nothing which specifically excludes lost units when bTargetEnemy is set (which is thge default setting for all abilities if not explicity set in AI config).
Proposal would be to add an additional variable (bExpliciltyExludeLost or similar) to the AoETargetingInfo struct and set up some code to remove lost units from the valid targets UnitList array if that bool is set (similar to how the Deprioritised effects bit works in the GetUnfilteredAOETargetList function).
Advice on whether this would be a sensible approach would be greatly appreciated!
The text was updated successfully, but these errors were encountered: