Moving Aircraft Around on the Ground

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
SeaQueen
Posts: 1436
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

Moving Aircraft Around on the Ground

Post by SeaQueen »

Is there a way in LUA to periodically reposition aircraft on the ground? In order to make a strike problem harder, I'd like to "reshuffle the deck," now and then.
Durendal28
Posts: 9
Joined: Wed Apr 22, 2020 7:56 pm

RE: Moving Aircraft Around on the Ground

Post by Durendal28 »

You could use the ScenEdit_HostUnitToParent function to move aircraft to hangers, parking spaces, etc.
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Moving Aircraft Around on the Ground

Post by michaelm75au »

Use unit.base to set the aircraft to a different 'facility' such as below

local base = ScenEdit_GetUnit( { name='Airfield', side='NATO' })
local facilities = base.group.unitlist -- list of facilities at base
local x = math.random(1,#facilities )
u = ScenEdit_GetUnit({ name = facilities[x]})
unit.base = u

You would filter the 'facilities' list to only include items that can host the aircraft; like a 'control tower' shouldn't be counted. Or leave them in, and skip assigning the aircraft to it - let it stay at the original location.
[This is just scripted without any checking as to practicality as not running Command at the moment. I sure others can give you a more precise example.[:D]]
Michael
Post Reply

Return to “Lua Legion”