_qor 11 Posted January 13, 2014 (edited) Hey there, I want to create a script which evaluates the intensity of an attack, for example on an airbase. Depending on the result, various countermeasures should get executed. So I would handle this with the detected by function. Counting every detected enemy force would give a realistic image of what friendly AI is aware of the enemy. I am trying with countEnemy, but the return value is always 0 although the AI attacks the enemies. Besides, how to use this not for a single unit but for a whole side? thanks for any help! :) Edited January 13, 2014 by _qoR Share this post Link to post Share on other sites
panther42 52 Posted January 13, 2014 A long shot, but I remember Kremator asking in this thread: Heart of the action .... how could I visualise a battlefield to know the 'front'? and I believe Rydygier came up with some demos. Might be of some help for you... Share this post Link to post Share on other sites
_qor 11 Posted January 13, 2014 Great idea and script, but I guess this leads to the wrong direction. The script evaluates where units die. But actually I need the information BEFORE they die. If 20 enemy units attack, these 20 units would be a threat to the base although they cant be shot and the script wouldnt execute. What about the countEnemy code? Why is the returned value alway 0? Share this post Link to post Share on other sites
iceman77 18 Posted January 13, 2014 (edited) countEnemy counts the amount of enemies in an array and returns a number. _enemyCount = player countEnemy allUnits; // allUnits return a list (array) of all units player sideChat format ["%1", _enemyCount]; // print _enemyCount (number) Edited January 13, 2014 by Iceman77 Share this post Link to post Share on other sites
_qor 11 Posted January 14, 2014 countEnemy counts the amount of enemies in an array and returns a number. Right, so I still dont get why using this code hint format ["%1", guy1 enemyCount list trigger1]; my returned number is alway 0. I created a group of enemies in the area of trigger1 and let guy1 move towards them, expecting it returns 3 or 4 when guy1 detected them. Share this post Link to post Share on other sites
panther42 52 Posted January 14, 2014 for one, you have the command wrong... it's countEnemy, not enemyCount Right, so I still dont get why using this code hint format ["%1", guy1 enemyCount list trigger1]; my returned number is alway 0. I created a group of enemies in the area of trigger1 and let guy1 move towards them, expecting it returns 3 or 4 when guy1 detected them. hint format ["%1", guy1 countEnemy list trigger1]; Share this post Link to post Share on other sites
_qor 11 Posted January 14, 2014 (edited) Big sorry! I just wrote it down in a hurry, ingame code was correct. Problem was, that I didnt set the trigger to get activated by OPFOR! So having the code running, I tried a bit and it turns out that there already is kinda build in evaluation. At least AI share their knowledge about enemies to friendly units. So if they have a GUARD waypoint, they will move towards those enemies - regardless of that, they get the shared information. And apparently AI arranges enemies to which has been detected first and prioritizes the first detected. Great stuff, didnt know that! Gonna keep trying this out... Edited January 14, 2014 by _qoR Share this post Link to post Share on other sites