OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ONoSixIsDown on 17 Nov 2005, 12:42:58
-
in order to prevent the classic "Run around like a moron while looking for that last enemy" problem, i'm trying to put together a script that will complete an objective when a certain number of units from a certain group are dead.
can someone show me a good script to use?
-
#loop
? (count units group1 <= 2) : "1" ObjStatus "DONE"; exit
goto "loop"
something like that ::) Been a while since I scripted anything, and my memory is kinda bad. But that should check if the numbers of units left in group1 is less or equal to 2, and then set objective 1 to done, and exit the script...if it works :P
-
thanks man.. big help... thats exactly the kind of thing i was looking for...
-
what would i need to change in that script if i wanted to have it check how many units are left in multiple groups?
-
OhNoSixIsDown, you obviously meant to unsolve this so I'll save you the trouble. :) Solving locks the thread so nobody can reply.
When using count to check the number of live loons in a group, always combine it with an alive command. Count alone can result in a severe delay (several minutes) while the group leader doesn't know that "6 is down".
"alive _x" count units group1 <= 2
Syntax not guaranteed.
There are several ways of doing what you want. You can just add the lines together:-
("alive _x" count units group1 <= 2) and ("alive _x" count units group2 <= 2) and ...
Or you could make a trigger:-
Area: whole map
Activation box: West present
Condition: count thislist < 3
On Activation: as you like
The trigger will fire when the number of West loons on the map drops below 3. A vehicle counts as 1 even if it has several crew: the count will rise if they disembark.
Oh, and please try to avoid making consecutive posts in the same thread. (It's ok if a long time has passed.) Use the (http://www.ofpec.com/yabbse/YaBBImages/modify.gif) button in the top right hand corner of the post. ;)