"UnitBaseStatus" trigger

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
lumiere
Posts: 286
Joined: Tue Mar 19, 2019 10:38 am

"UnitBaseStatus" trigger

Post by lumiere »

For new MDSP tutorial series what attracted me most was UnitBaseStatus trigger rathar than new strike mission settings.

This trigger will be fired when target's (it could be ranged from all units of side to specific unit) current status changed to desired condition.

Currently this trigger is not configuable via Event Editor (hope it could be done soon) and requires ScenEdit_SetTrigger() function.

Here is my code:

Code: Select all

local trigger = "Blue_AircraftLands"
local TargetFilter={
TargetSide= 'Blue',
TargetType= "Aircraft",
TargetSubType= nil,
SpecificUnitClass= nil,
SpecificUnitID= nil,
}
local TargetCondition= 6
local trigger = ScenEdit_SetTrigger({mode="update", name=trigger, type="UnitBaseStatus",
TargetFilter=TargetFilter, TargetCondition=TargetCondition})
print(trigger)
"TargetFilter" specifies by table what unit to check. You need at least "TargetSide" value.

"TargetCondition" (Lua Docs incorrectly says "TargetStatus" but I got error for this) specifies target's desired status. I only checked for aircrafts but I could find following values:
0 = Airborne
1 = Parked (Ready)
2 = Taxiing to take off
3 = Taxiing to parking spot
4 = Taking off
5 = On final approach
6 = Completing landing
7 = Readying

Possible event I came up with using this trigger is "Belenko landed to Hakodate Airport", "Cancel aircraft's taking off under bad weather" or "Automatically change aircraft loadout after landing".

Hope this post helps.
"How Do You Stay Calm With A 7,000 Ton Nuclear Predator Listening For Your Heartbeat?"
My Lua garbages (Github)
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Re: "UnitBaseStatus" trigger

Post by KnightHawk75 »

Thanks, I had even forgot UnitBaseStatus was added under the hood.
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

Re: "UnitBaseStatus" trigger

Post by michaelm75au »

I have implemented the Lua UnitBaseStatus into the UI; got fed up extracting it from GetTriggers() all the time. :D
Michael
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Re: "UnitBaseStatus" trigger

Post by KnightHawk75 »

michaelm75au wrote: Sat Mar 18, 2023 10:16 am I have implemented the Lua UnitBaseStatus into the UI; got fed up extracting it from GetTriggers() all the time. :D
Nice! :D :D
Post Reply

Return to “Lua Legion”