OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Cheetah on 24 Feb 2007, 12:48:58
-
Some may have noticed this issue before, the situation:
a script which outputs the number of living squad members
_squadName = GroupAlpha;
#loop
_alive = count units _squadName;
hint format ["%1", _alive];
~1
goto "loop"
A squad of men, all with names (not that it matters), and the leader has:
GroupAlpha = group this;
The problem
The output of the "hint format" isn't up to date with the situation. For example, if I kill a soldier, it takes about 5 seconds or so to change the group count. Killing whole the squad in seconds, results in waiting over 30 seconds before the count says 0.
Question
Is there an easy method to speed this command up? It's too easy for what I have in my mind. I hope that there is a simple way to make it faster, or a way, involving the groupname to count units but faster than using the code I use now.
-
You may try:
squadName = GroupAlpha;
#loop
_alive = {alive _x} count units _squadName
hint format ["%1", _alive];
~1
goto "loop"
-
Great thanks Mandoble, works perfectly. Thought that I tried that one, it's just that I didn't use the curled brackets, used "" instead. Gave me an error.
Locking.
-
Bah, this is ArmA, use the sqf format and drop the sqs already
while {true}
do {
_alive = {alive _x} count units _squadName;
hint format ["%1", _alive];
sleep 1;
};
-
for anything like this, i tend to use one large trigger encompassing the entire playing area
named tx_maintrig
set to:
Activation: Anybody, Repeatedly
I dont have anything in the "On activation field etc
and then from this i simply run scripts, which use "list tx_maintrig" for calculating casualty rates, unit lists, vehicle lists etc
the trigger used in this way is remarkably efficient imo
however its more efficient / useful when gathering data on multi arrays, objects in mp than for a simple group as would seem to be your requirement here