Page 1 of 1
LUA Base support
Posted: Thu Jun 08, 2017 4:02 pm
by AlphaSierra
Is it possible to change a base with lua?
No Joy with ScenEdit_UpdateUnit({name='USS Illinois (SSN-786)', guid='b2a4bed1-5d69-4f8f-a759-f9b4a4832646',base='NewBase'})
RE: LUA Base support
Posted: Fri Jun 09, 2017 3:45 am
by michaelm75au
From memory, the new base needs to be a 'unit' object
Firstly, you are using wrong command. UpdateUnit() is used to update the components (weapon/sensors) of the 'unit'.
local unit = ScenEdit_GetUnit({name='USS Illinois (SSN-786)', guid='b2a4bed1-5d69-4f8f-a759-f9b4a4832646'})
local newbase = ScenEdit_GetUnit({name='NewBase'})
unit.base = newbase
RE: LUA Base support
Posted: Fri Jun 09, 2017 6:59 am
by AlphaSierra
I shall give that a try
Thank you
RE: LUA Base support
Posted: Fri Jun 09, 2017 12:25 pm
by AlphaSierra
No luck there either even ScenEdit_SetUnit does not seem to support base wow
RE: LUA Base support
Posted: Fri Jun 09, 2017 11:16 pm
by Dan109
Try ScenEdit_HostUnitToParent. Here are the results from a test I did. Probably doesn't do what you want, to change base while deployed and not 'teleport' to the new base. Maybe there should be a bool flag on this SE function, to physically move it or not.
>> my_unit = ScenEdit_GetUnit({name='Green Pawn #1', guid='49bb27a4-7107-4a95-9402-8d5f05d432f7'})
print(my_unit)
ScenEdit_HostUnitToParent({HostedUnitNameOrID='Green Pawn #1',SelectedHostNameOrID='CVN 77 George Bush [Nimitz Class]'})
print(my_unit)
unit {
type = 'Aircraft',
subtype = '8201',
name = 'Green Pawn #1',
side = 'US Navy',
guid = '49bb27a4-7107-4a95-9402-8d5f05d432f7',
proficiency = 'Regular',
latitude = '26.1435543761475',
longitude = '-80.0242708081714',
altitude = '0',
speed = '46.66667',
throttle = 'Loiter',
autodetectable = 'False',
base = 'LCS 17 Indianapolis [Freedom LCS]',
mounts = '0',
magazines = '0',
unitstate = 'Unassigned',
fuelstate = 'None',
weaponstate = 'None',
}
unit {
type = 'Aircraft',
subtype = '8201',
name = 'Green Pawn #1',
side = 'US Navy',
guid = '49bb27a4-7107-4a95-9402-8d5f05d432f7',
proficiency = 'Regular',
latitude = '26.2126470332819',
longitude = '-79.8800780252283',
altitude = '0',
speed = '46.66667',
throttle = 'Loiter',
autodetectable = 'False',
base = 'CVN 77 George Bush [Nimitz Class]',
mounts = '0',
magazines = '0',
unitstate = 'Unassigned',
fuelstate = 'None',
weaponstate = 'None',
}
Results from the UI, the aircraft was 'teleported' from the LCS to the CV, which is not very applicable during a scenario execution
RE: LUA Base support
Posted: Fri Jun 09, 2017 11:33 pm
by michaelm75au
ORIGINAL: AlphaSierra
No luck there either even ScenEdit_SetUnit does not seem to support base wow
Sorry my mistake.[:o]
Being able to set it direct has been made for the future so you don't need to use the 'HostToParent'
RE: LUA Base support
Posted: Sat Jun 10, 2017 6:19 am
by Dan109
Any idea when there will be some additional LUA from the beta doc page will be added to the general release? I just learned of the beta page, and am looking forward to the things I'm seeing there.
RE: LUA Base support
Posted: Sat Jun 10, 2017 6:30 am
by michaelm75au
As things are released, I'll move them to normal page.
RE: LUA Base support
Posted: Sat Jun 10, 2017 7:29 am
by AlphaSierra
This is the direction I was heading
I am doing some testing with this to see if I can get my bombers to drop and then change their base
Thanks Man!
RE: LUA Base support
Posted: Sat Jun 10, 2017 7:32 am
by AlphaSierra
good to know! Thank you
playing with the host to parent is a no brainer for moving your assets around a base