Event coding question

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3669
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

Event coding question

Post by vettim89 »

I have a series of events I want to trigger and am trying to find the best solution.

Here is the problem

1. There is a CAP mission set up over a target with 12 aircraft set with the 1/3 rule = true
2. If an enemy raid is detect inbound, an event triggers that converts the mission to 1/3 rule = false
3. After a period of time has passed sufficient to allow for enemy raid ingress, attack, and egress I want to return the mission to its base state of 1/3 rule=true

I have set the event action to ScenEdit_SetMission({onethirdrule=true})

The problem is that immediately after the raid assuming all twelve aircraft will be in the air. I am looking for a code that will tell 1/3 of the airborne aircraft to land.

Can I use the condition_v: value from the unit table? Documentation doesn't really explain other than its the air ops condition. I am assuming (and correct me if I am wrong) that this is a value to determine landed vs airborne. If I am right, what are the values this call returns (documentation says "string")

I have an idea of using a loop with a check for unit existing and airborne and then setting the remaining aircraft to RTB.

I just need to be sure if I can use the "condition_v" parameter and what the expected values are
"We have met the enemy and they are ours" - Commodore O.H. Perry
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Event coding question

Post by michaelm75au »

Free thought suggestion:
You can check the units assigned list to the mission SE_GetMission(..).unitlist
Check the time in the air by using unit.airbornetime (to see if flying) and unit.unitstate (to see if already RTBing)
Michael
Post Reply

Return to “Lua Legion”