Ventis 10 Posted August 21, 2009 Hi everyone, this is my first post here but I've been an avid OPF, Arma user from the very beginning. I like to create missions for personal and LAN use (if they were good enough, I would've released them) and I've been having the following problem for some time now. Although it's easy to detect when all units for a certain sides are dead, I'm having a lot of problems detecting and displaying the actual units alive. My dream would be to have a force counter in the upper left corner of the screen displaying the currently alive and total units of each side on the map. Example: West: 23/60 units alive East: 15/60 units alive I've searched the web endlessly but have never found something that comes close. I know that I need a script which detects the total number of units for each side at the beginning of the mission, save that in a variable, then continuously check the number of alive units and display that in some sort of box in the upper-left corner. Any help would greatly be appreciated, even with the displaying of the box. :) Share this post Link to post Share on other sites
Gigan 1 Posted August 21, 2009 Hi, nearObjects http://community.bistudio.com/wiki/nearObjects The object within the specified limits is acquired. alive http://community.bistudio.com/wiki/alive It is judged whether the object is alive. The total of a unit is first acquired with the nearObjects command at the beginning of missions. The life and death of all the unit of them are checked with the alive command, using nearObjects command periodically also after that. What is necessary is to count the number of the dead units and just to deduct from the total of a unit. The rest expresses the number as the hint command etc. Share this post Link to post Share on other sites
Ventis 10 Posted August 22, 2009 Thx, I'll give it a go. Share this post Link to post Share on other sites
Murklor 10 Posted August 22, 2009 Cant one just place a massive trigger which runs a script count how many are inside, split them by side and print currently alive/originally alive? Share this post Link to post Share on other sites
Ventis 10 Posted August 29, 2009 Is this possible? I'm not having much luck with the tips Gigan gave me. Share this post Link to post Share on other sites
NeoArmageddon 958 Posted August 29, 2009 (edited) Place a two trigger. One activated by west, one by east... Activation: multiple. name the trigger westunitlist and eastunitlist. Write this in your init.sqf: AliveWest=0; AliveEast=0; StartAliveWest=count list westunitlist; StartAliveEast=count list eastunitlist; [] execVM "check.sqf"; check.sqf: while {true} do { AliveWest=count list westunitlist; AliveEast=count list eastunitlist; hintsilent format["West: %1/%2 \n East: %3/%4",AliveWest,StartAliveWest,AliveEast,StartAliveEast]; sleep 2; }; I just wrote it here, its not tested. P.S. This wont work in huge mp battles without some changes (streamingengine). Edited August 29, 2009 by NeoArmageddon Share this post Link to post Share on other sites
Gigan 1 Posted August 30, 2009 Cant one just place a massive trigger which runs a script count how many are inside, split them by side and print currently alive/originally alive? The number in the group which advanced into the trigger is counted. forcecount.utes.zip I don't know whether it operates in mp. Share this post Link to post Share on other sites
Ventis 10 Posted August 31, 2009 Doesn't work NeoArmageddon. Do I have to call init.sqf in the editor? I thought it executed automatically. It works somewhat if I place the code in triggers instead of the sqf files but it displays the numbers as "scalar" and only executes the script once, instead of continuously. Gigan, I can't open yours in the editor, it says it's read-only. I can't launch it either when I put it in the missions folder. Share this post Link to post Share on other sites
NeoArmageddon 958 Posted September 1, 2009 Okay.... try to put the count in brakets... for example: AliveWest=count(list westunitlist); AliveEast=count(list eastunitlist); Maybe you named the triggers wrong, or they are not set to multiple activation. The init.sqf is started automaticly. Check if their is a hidden ".txt" behind the file and have a look in your arma2.rpt http://community.bistudio.com/wiki/Crash_Files#ARMA_2 Share this post Link to post Share on other sites
Murklor 10 Posted September 1, 2009 You can do the same with just one trigger (anybody) btw: _west = west countSide (list trigger); _east = east countSide (list trigger); Share this post Link to post Share on other sites
Ventis 10 Posted September 1, 2009 (edited) the rpt says "Error while: Type Bool, expected code" ---------- Post added at 04:59 PM ---------- Previous post was at 04:54 PM ---------- Oh lol, i see now. I used while () do instead of while {} do. The output right now is 53/scalar, 32/scalar so StartAliveWest and East are still displayed as scalar. Any ideas? ---------- Post added at 05:14 PM ---------- Previous post was at 04:59 PM ---------- Fixed that as well, it was a timing issue. When it was executed in init.sqf triggers were probably not set yet or maybe the units weren't placed yet. Anyway, I put a sleep of 2 seconds before the code execution in init.sqf and that fixed it. Thx for your help guys! Edited September 1, 2009 by Ventis Share this post Link to post Share on other sites