Jump to content
Sign in to follow this  
exec

% of enemies eliminated = completed objective

Recommended Posts

Hi. Im working on a mission that requires the players to clear most of a large town occupied with enemy combatants to complete an objective. I want the objective to tick after a certain percentage of enemies are eliminated (Ie. 80%).

I thought to see this info posted before, did the search but couldnt find the topic.

Any help - much appreciated!

Share this post


Link to post
Share on other sites

It should be something like:

At the beginning:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_enemyNum = count units Group1

_enemyNum = _enemyNum  + count units Group2

_enemyNum = _enemyNum  + count units Group3

...

_enemyNum = _enemyNum  + count units GroupX

And when the mission goes:

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

#startCheck

~4

_enemyNum = count units Group1

_enemyNum = _enemyNum  + count units Group2

_enemyNum = _enemyNum  + count units Group3

...

_enemyNum = _enemyNum  + count units GroupX

? (_enemyNum/_enemyCount  > 0.2 ) : goto "startCheck"

#endMissionPart

Put as many groups as you want, but don't forget to define them.

0.2 at the end is if 20% of units still live, the mission will end

Share this post


Link to post
Share on other sites

Use a trigger that covers the town. Condition: true, onActivation:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">EastUnits = []; {if (side _x == east) then {EastUnits=EastUnits+[_x]}} forEach thislist; MinEastAlive = count EastUnits * 0.2

Then you need the end trigger. Condition:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"alive _x" count EastUnits <= MinEastAlive

This one should activate once you killed 80%+ of the east units in the trigger on the beginning.

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  

×