Jump to content
Sign in to follow this  
dirty_bastard

Percent dead

Recommended Posts

Hi I'm creating a mission in wich I have several units passing through a town and a group of soldiers must prepare an ambush for them.

PROBLEM:

I want an enemy reinforcement unit to arrive to by chopper but only when a certain percent of the enemy in the town have died. Is there any I can do this with a trigger??

Share this post


Link to post
Share on other sites

The following may contain errors since I'm just typing this off top of my head but this is the general idea.

Make a trigger called areaTrigger. Make sure that each enemy unit you wish to count is inside the trigger area in the beginning:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">EAST (assuming East is the enemy), PRESENT, ONCE

Condition: THIS.

On activation: enemyArray = list areaTrigger;totalEnemies = east countside list areaTrigger<span id='postcolor'>

Now make another trigger:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Condition: (east countSide enemyArray)/(totalEnemies) < 0.2

On Activation: hint "The reinforcements are arriving" (here you must call in the reinforcements, I assume you know how)<span id='postcolor'>

The value of 0.2 would cause the reinforcement-hint to display when 80% of the enemies are dead.

Share this post


Link to post
Share on other sites

Yes, it is possible. I would do it using the count command.

Let's suppose you have a group (grp1, ie) of 12 and want reinforcements when their're below 50% of the strenght. Set a switch trigger and type this as condition:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Count Units grp1 < 6<span id='postcolor'>

Then tie with a sync line (F5) the trigger with a waypoint that will be holding the reinforcements until called. When 5 or less guys are left on that group the condition will become true.

Edit: Spitfire's solution is better, I've just left a solution for a specific case.

Share this post


Link to post
Share on other sites

Your suggestion works only with 1 group, but counting units inside an area trigger works with as many units/groups as you wish.

btw. Instead of making the second trigger, you can type the condition field directly to the condition field of the waypoint you wish the reinforcement unit to wait. That way the waypoint will be activated only when the condition

(east countSide enemyArray)/(totalEnemies) < 0.2

is met

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×