Can I insert aircraft and set their altitude manually with scenario editor?

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
fatgreta1066
Posts: 513
Joined: Sun Dec 30, 2012 2:37 am

Can I insert aircraft and set their altitude manually with scenario editor?

Post by fatgreta1066 »

I've not found a way to use the editor to adjust aircraft altitude. Is there a way to do that that I'm missing, either with an existing unit or when inserting an airplane?
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: Can I insert aircraft and set their altitude manually with scenario editor?

Post by Rory Noonan »

You can use Lua, which I understand is a bit daunting for some people. To do that you would simply add an altitude field to the table of values in the ScenEdit_AddUnit() function.

Example:

Code: Select all

ScenEdit_AddUnit({side='Side A', 
 name='Example', 
 dbid=101, 
 latitude='44.9632137832197', 
 longitude='139.243733000805',
 altitude = 2000})

Or, for a simpler method you could use ScenEdit_SetUnit(). Step by step:
1. Place your unit manually as normal
2. Select the unit and press Ctrl+C
3. Open the Lua console via Editor > Lua Script Console
4. In the drop down, find ScenEdit_SetUnit(), select it and click insert.
5. Put your mouse cursor inbetween the brackets and press Ctrl+V
6. Your console field should look like this:
ScenEdit_SetUnit({name='SH-60B Seahawk', guid='62e35c2a-7880-4706-8527-5e1a65df66ac'})
7. Now put your cursor inside the final curly-braces
ScenEdit_SetUnit({name='SH-60B Seahawk', guid='62e35c2a-7880-4706-8527-5e1a65df66ac'CURSOR_GOES_HERE})
8. Now type the following:
, altitude = 10000
9. This should have your console input looking like this:
ScenEdit_SetUnit({name='SH-60B Seahawk', guid='62e35c2a-7880-4706-8527-5e1a65df66ac', altitude = 10000})
10. Click 'Run' et viola your aircraft is now at the desired altitude. Note that the default measurement of altitude is in metres, so you will need to adjust for that if you're after an altitude that is measured in feet.
Otherwise the default is to add aircraft at their default cruise height (~2Kft for rotary wing, ~36Kft for jet fighters). To move them to a different altitude you can simply set the altitude in the speed/altitude menu (F2). On running the scenario they'll move to that altitude. If it's important that they begin at that altitude, I can only recommend that you run the scenario a few moments to get them at their desired altitude and then reset the scenario elapsed time through Editor > Scenario Times & Duration
Image
fatgreta1066
Posts: 513
Joined: Sun Dec 30, 2012 2:37 am

RE: Can I insert aircraft and set their altitude manually with scenario editor?

Post by fatgreta1066 »

Thanks for that explanation. It's more work than it's worth at this point, but I'm very glad to have theinformation for future consideration.

Chris
Post Reply

Return to “Lua Legion”