How to trigger a mission with a condition of quantity ?

Share your best strategies and tactics with other players by posting them here.

Moderator: MOD_Command

Post Reply
FoxZz
Posts: 92
Joined: Tue Apr 28, 2015 4:37 pm

How to trigger a mission with a condition of quantity ?

Post by FoxZz »

Hello,

I'm trying to create a mission where I want the AI side to scramble an interception air patrol in order to ID incoming bogeys.
However, I would like the number of planes scrambled to be set accordingly with the number of bogeys detected.

So that if many bogeys are detected, the AI scramble more planes than if a single bogey is detected.

I was thinking to create two separate interception mission, one with 2 planes ready to be scrambled, and another one with 4 planes.

The first mission would trigger if the number of bogey is between [1,4] and [8,infinite]
The second mission would trigger of the number of planes is between ]4,infinite]

So that if 1,2,3,4 bogeys are detected, mission 1 fire
between 5 and 8, mission 2 fires
from 8 and above, mission 2 and mission 1 fire

This would allow the AI to have depending on the number of bgeys 2,4, or 6 planes in the air.

Is there an LUA function for this ?

Thanks.
FoxZz
Posts: 92
Joined: Tue Apr 28, 2015 4:37 pm

RE: How to trigger a mission with a condition of quantity ?

Post by FoxZz »

bump
Yokes
Posts: 298
Joined: Tue Mar 13, 2007 9:27 pm

RE: How to trigger a mission with a condition of quantity ?

Post by Yokes »

I know of an ugly way to do it.

Let's say you have X enemy aircraft that could trigger this.

First, you need to create X "keyvalue" entries, one for each aircraft, initialized to false. These will be used to keep the event only triggering once per aircraft. You will also need a "keyvalue" initialized to false to act as a timer.

Next, you create X "unit enters area" triggers, one for each aircraft. For each of these triggers, the action would check that unit's "keyvalue", and if false it would add one to a counter "keyvalue". Also, you would need to check to see if the timer value is false. If so, then this is the first aircraft to enter the zone, so you would need to start the timer. I recommend moving a unit (I like to use city markers) into an area defined by waypoints, with a "unit remains in area" trigger. This can all be hidden from the player in a non-player side.

Finally, when the timer goes off, you look at the counter "keyvalue" to see how many aircraft have entered the area. You can then figure out how many aircraft to assign to the intercept mission from that.

This is "ugly" since it would only work once without resetting all the counters and variables. That can also be done, but it would take a lot of actions.

Yokes
FoxZz
Posts: 92
Joined: Tue Apr 28, 2015 4:37 pm

RE: How to trigger a mission with a condition of quantity ?

Post by FoxZz »

I'll try it and see if it's viable in the mission.
Thank you very much :)
Post Reply

Return to “The War Room”