johnnyboy 3741 Posted December 21, 2018 I want to be able to detect if a particular AI is being fired at by the enemy. FiredNear eventHandler is not good enough, as the AI may not be the target, and anyone within 70 meters (friend or foe) could be firing. I can put Fired eventHandlers on the enemy AI, but that eventHandler does not tell you who he is shooting at. How can I detect when AI shooting at or near a particular AI? Thanks! Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted December 21, 2018 14 minutes ago, johnnyboy said: I want to be able to detect if a particular AI is being fired at by the enemy. FiredNear eventHandler is not good enough, as the AI may not be the target, and anyone within 70 meters (friend or foe) could be firing. I can put Fired eventHandlers on the enemy AI, but that eventHandler does not tell you who he is shooting at. How can I detect when AI shooting at or near a particular AI? Thanks! You could use assignedTarget inside the fired eventhandler, but that doesn't work reliably either, since it can occasionally return objNull for some reason. Tried to do something similar back in the days without finding a 100% reliable way to return a units current target. Cheers 3 1 Share this post Link to post Share on other sites
pierremgi 4737 Posted December 22, 2018 Yes, same remark as GOM. For my turrets, changing ammo along with the type of target, I'm using: _tgts = (_unitFiring targets [true,700]) apply {[_unitFiring aimedAtTarget [_x],_x]}; _tgts sort false; _tgt = _tgts select 0 select 1; Perhaps, it's a little bit heavy as you need to loop it and apply it to several units. 2 1 Share this post Link to post Share on other sites