Devastator_cm 434 Posted December 3, 2016 Am I doing something wrong or is this BIS function buggy?When I place a OPFOR static weapon (with its unit) infront of a blufor unit BIS_fnc_EnemyTargets returns nothing although blufor has 4 for the knowsabout of opfor unit. Somehow BIS_fnc_EnemyTargets ignores static weapons? Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted December 4, 2016 Can confirm this, gonna take a closer look into that function. Fun thing is that BIS_fnc_enemyDetected or whatever it's called is also not working if there's only one static mg engaging the unit. Edit: Seems like this function only checks the driver of a vehicle. Temporary fix: _unit = player; _enemySides = _unit call BIS_fnc_enemySides; _enemies = (_unit neartargets 2000) apply {_x select 4} select {side _x in _enemySides AND {count crew _x > 0}}; Runs almost twice as fast compared to BIS function. Cheers 1 Share this post Link to post Share on other sites
Devastator_cm 434 Posted February 15, 2017 On 04.12.2016 at 7:32 AM, Grumpy Old Man said: Can confirm this, gonna take a closer look into that function. Fun thing is that BIS_fnc_enemyDetected or whatever it's called is also not working if there's only one static mg engaging the unit. Edit: Seems like this function only checks the driver of a vehicle. Temporary fix: _unit = player; _enemySides = _unit call BIS_fnc_enemySides; _enemies = (_unit neartargets 2000) apply {_x select 4} select {side _x in _enemySides AND {count crew _x > 0}}; Runs almost twice as fast compared to BIS function. Cheers I just noticed something weird. The workaround returns also something with "Logic" type (found via typeOf). I checked the location and there is a soldier on a military tower but from same fraction. That soldier had animation done with BIS_fnc_ambientAnimCombat. Is BIS_fnc_ambientAnimCombat creating a game logic? That is the only explanation I have at the moment how game logic appeared there. Is there a nica way to filter such objects by your fix? Share this post Link to post Share on other sites
Devastator_cm 434 Posted February 15, 2017 looks like not Bis_fnc but one of the mod is creating logic at towers. Didn't find which one it is yet though. I filtered them out with AND typeOf _x != "Logic" Is neartargets using 2d distance right? Share this post Link to post Share on other sites
warkonaut 133 Posted February 20, 2017 Hi there. Thanks for the feedback. Both functions (bis_fnc_enemyTargets and bis_fnc_enemyDetected) are built on nearTargets command, which is not very performance friendly. At the time, they were created there were no commands like array select expression or array apply expression and to be honest the scripted functions were not optimized for best performance. I refactored both functions. The results are relative to test scenario so take them with grain of salt. On scenario, where there are 128 enemy targets the bis_fnc_enemyTargets now runs about 3x faster and bis_fnc_enemyDetected runs about 10x faster. We are still not happy about the performance, but both commands used in those functions (nearTargets and targetsQuery) are quite old and their functionality is tight closely to core target handling mechanics = not that easy to refactor. We are looking into our possibilities, if we could create a new command that would provide you with the same output as the bis_fnc_enemyTargets does, but would work considerably faster. Regarding the game logics and function bis_fnc_ambientAnimCombat, the function creates those logics for ambient units attaching. 1 Share this post Link to post Share on other sites
Devastator_cm 434 Posted February 20, 2017 4 hours ago, warkonaut said: Hi there. Thanks for the feedback. Both functions (bis_fnc_enemyTargets and bis_fnc_enemyDetected) are built on nearTargets command, which is not very performance friendly. At the time, they were created there were no commands like array select expression or array apply expression and to be honest the scripted functions were not optimized for best performance. I refactored both functions. The results are relative to test scenario so take them with grain of salt. On scenario, where there are 128 enemy targets the bis_fnc_enemyTargets now runs about 3x faster and bis_fnc_enemyDetected runs about 10x faster. We are still not happy about the performance, but both commands used in those functions (nearTargets and targetsQuery) are quite old and their functionality is tight closely to core target handling mechanics = not that easy to refactor. We are looking into our possibilities, if we could create a new command that would provide you with the same output as the bis_fnc_enemyTargets does, but would work considerably faster. Regarding the game logics and function bis_fnc_ambientAnimCombat, the function creates those logics for ambient units attaching. Thanks alot for the adjustment! I assume it is in dev. branch at the moment right? I will wait the stable release and then will test it. I hope the refactored function is takin care of the game logics :-). I had a situation where AI was stuck in area as it was thinking there is an enemy nearby. I know Christmas passed and might be late to make wishes but as topic came to enemy detection for AIs it would be also nice to have a function/command which returns good positions for a unit to attack a target. I am trying to write something by myself at the moment to achieve (via overwatch + checkvisibility) this but a BIS solution would ease many mission makers and scripters life I beleive. Share this post Link to post Share on other sites