Open BlackDog86 opened 3 months ago
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
class X2Condition_NotLost extends X2Condition;
event name CallMeetsCondition(XComGameState_BaseObject kTarget)
{
local XComGameState_Unit UnitState;
UnitState = XComGameState_Unit(kTarget);
if (UnitState != none)
{
if (UnitState.GetTeam() != eTeam_TheLost)
{
return 'AA_Success';
}
}
else return 'AA_NotAUnit';
return 'AA_AbilityUnavailable';
}
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.
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!