PDA

View Full Version : How to check if enemy groups are less then 30%?



R3dBuLL
Jun 12 2009, 21:48
Hi,
I wanna make a mission where u defend a postion and enemy is attacking u and tries to overrun u. The mission will be over if only 30 % of their mans/vehicles are left. How to do that? Is that possible with a simple trigger? And how can I check if a whole group is still alive?

Bon
Jun 13 2009, 10:20
Hi,

try to place a trigger which area covers the whole map, and give it a name, lets say the name Enemies.
It must activate on PRESENT OPFOR (respectively the enemy side), REPEATED.
Thats it. Now when this Trigger is active, i.e. there are ALIVE enemy troops in its area, then you can access all alive enemy units with the array "list Enemies".
Using the command "count" then you can count the enemies in this array.


if((count list Enemies)<value) then{end the game...}


Accessing all units of a group its almost the same, the array then is called "units group <Groupname>", where Groupname is typically the name you assigned to the particular groupleader.


EDIT: BTW all that stuff you can find more or less in Mr-Murrays Editing Guide. Its always a good idea to check that first.

R3dBuLL
Jun 13 2009, 16:43
The command "units group" and that thing with counting is what I was looking for ^^

I know mr murrays editing guide and I try to find the answer there first before searching in the internet.

Anyway thanks a lot!

yyccccc
Jun 15 2009, 04:53
if((count list Enemies)<value) then{end the game...}


I paste your code into on act. but it does not work.

Benny.
Jun 15 2009, 10:04
I suggest you to use a countside (http://community.bistudio.com/wiki/countSide) with some math commands in the trigger condition.

Exemple (this only works if units are already inside the trigger, just replace east by the side that you want):


Activation:
((((east countSide thislist)/100)*30) <= 30)


Couldn't test it yet as i don't have arma around but it shall works.

yyccccc
Jun 15 2009, 13:11
Exemple (this only works if units are already inside the trigger, just replace east by the side that you want):


Activation:
((((east countSide _thislist)/100)*30) <= 30)


I try this code does not work, local variable in global space?

Benny.
Jun 15 2009, 16:22
Sorry my bad, try with thislist instead of _thislist