Jump to content
Sign in to follow this  
xawery

Trigger true when one side outnumbers the other

Recommended Posts

Hi there,

I have yet another question for the wise ones on this forum smile_o.gif

In my mission, one of the objectives is to capture a city. Right now, I have two triggers surrounding the objective: when checking for the presence of West (attackers) and one checking for the absence of East (defenders). If both are true, the objective is captured. This is of course a very rudimentary and rather unelegant solution. What is more, it means that West needs to clear the town of all enemy troops to capture it: one last Soviet soldier hiding in a building will prevent West from reaching its objective. Hardly realistic, and hardly fun.

What I would like to do is have the trigger monitor the troops within it, and become activated once West outnumbers East.

The problem is, I have no idea how to do it (surprise surprise!wink_o.gif. Any help would be, as per usual, much appreciated smile_o.gif

Regards,

Xawery

Share this post


Link to post
Share on other sites

Put one presence trigger per side in the city, check continuosly, name them tr_west and tr_east and another trigger with the following condition:

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

((count list tr_east)*100/(count list tr_west))<20

When the east units are less than 20% of west units, this third trigger will be activated.

Share this post


Link to post
Share on other sites

A bombing script I was looking at about 5 years or more ago for this game introduced me to a command called thislist.

It worked by having a trigger turn on when a specific unit entered the trigger. In this case it was called mya10 or something like that. Basically any west unit entering it would not set if off even though it was a west present trigger. As soon as this particular unit went through it, the trigger went off.

It worked by having this line of code in the condition field of the trigger:

mya10 in thislist

So perhaps it can count units present too? Here's a random and rusty as hell guess for the condition field:

(count units in thislist) => 50

I think this would count the number of west units in the trigger and activate if there were 50 or greater of them. If it works you'll need to find a way to compare it not to 50 but the number of east troops present. This could be done by making a running sensor (again I'm a bit rusty I'm afraid) which counted the number of east troops in the zone and loaded the figure into a global variable which is accessible by the west present trigger.

You'll need someone alot fresher in this game than me to get the final solution but I think this would work mate wink_o.gif

**Edit**

LOL or just do what he said biggrin_o.gif

Share this post


Link to post
Share on other sites

Hey lads,

thanks for the quick replies. Mandoble's solution works like a charm on desert island, but when I place the exact same triggers in my mission OFP starts complaining about zero divisors sad_o.gif

I have no idea how this is possible, seeing as the west trigger (the denominator) is only activated once west units enter, thus making the denominator non-zero.

Gah, I'm at my wits' end here... Btw, wouldn't the CountSide function work in this case? I'm just guessing here, but wouldn't it be possible to place a single trigger around the town and name e.g. towntrig. Then, have an external script monitor the amount of side-specific troops within the trigger using SideCount. Would this work?

Quote[/b] ]#START

_ACount = West CountSide list triggerone

_DCount = East Countside list triggerone

?(_ACount > _DCount ):ObjCap = true;

Goto "START"

And, if ObjCap is true, the game ends. Is this even theoretically correct or am I misusing the functions?

Share this post


Link to post
Share on other sites

Yes, you can use also countSide inside a script with the same result.

But may be you dont want to GOTO "START" after ObjCap = true tounge2.gif

Share this post


Link to post
Share on other sites

Hehe you might be right there Mandoble... tounge2.gif

Anyway, I did something simple, based on your suggestion. Two triggers (East and West) per objective. (count list tr_west)>(count list tr_east) did the trick.

Thanks for your help everyone!

Regards,

Xawery

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  

×