How to change a plane base by using Lua ? (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series



Message


M1A2G -> How to change a plane base by using Lua ? (9/13/2017 1:23:53 PM)

I know that when the airport can't land a plane,the plane itself will choose a new base.I want to use Lua to let plane choose a designated base.

This is the Action that I wrote:

ScenEdit_SetUnit({side='C',name='Dragon1',base='Wuhu AB (PLAAF)',newbase='Anqing AB'})

The event has been fired,but the plane do not change the base.Can somebody tell me what's wrong with it?




michaelm75au -> RE: How to change a plane base by using Lua ? (9/13/2017 1:47:00 PM)

I think it is:
quote:

local newbase = ScenEdit_GetUnit({side='C',name='Dragon1',base='Anqing AB'})
ScenEdit_SetUnit({side='C',name='Dragon1',base=newbase})




M1A2G -> RE: How to change a plane base by using Lua ? (9/13/2017 2:19:52 PM)

The plane still doesn't change it's base...



[image]local://upfiles/57780/A990AD1F20BF4D1FB4E90CD6CFF991D9.jpg[/image]




stilesw -> RE: How to change a plane base by using Lua ? (9/13/2017 3:44:01 PM)

One other way is to create a ferry mission to the base you want the plane to call home. Then, have some event trigger the plane being assigned to the mission. After it lands the new base will be its home.

Set up one-way ferry mission to Newbase, say "RTB Newbase" with no aircraft assigned.
Dragon1 is on some other mission.
Dragon1 (or something else) triggers an event which causes Dragon1 to be reassigned:

ScenEdit_AssignUnitToMission("Dragon1", "RTB Newbase")

I've used this several times, hope it helps.

-Wayne Stiles





M1A2G -> RE: How to change a plane base by using Lua ? (9/14/2017 1:00:57 PM)

When this action actives,will the plane RTB immediately ?

If it will,this is a good way not the best way.(Some planes may fight against enemies at that time)

But anyway,thanks for your reply.




stilesw -> RE: How to change a plane base by using Lua ? (9/14/2017 3:32:19 PM)

quote:

When this action actives,will the plane RTB immediately ?
If it will,this is a good way not the best way.(Some planes may fight against enemies at that time)


Yes, the subject aircraft will immediately be assigned to the RTB mission and head to the selected base. If you are concerned about the aircraft that is assigned to the RTB mission engaging enemies then you can set the RTB mission to "Hold" for all ROE actions when you create it. Using Lua you can also set the Rules of Engagement (ROE) for any other aircraft (or group or mission) that you may be concerned about.

-Wayne




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.859375