LUA Base support

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

LUA Base support

Post 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'})
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA Base support

Post 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
Michael
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: LUA Base support

Post by AlphaSierra »

I shall give that a try

Thank you
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: LUA Base support

Post by AlphaSierra »

No luck there either even ScenEdit_SetUnit does not seem to support base wow
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: LUA Base support

Post 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
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA Base support

Post 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'
Michael
Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: LUA Base support

Post 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.
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA Base support

Post by michaelm75au »

As things are released, I'll move them to normal page.
Michael
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: LUA Base support

Post 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!
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: LUA Base support

Post by AlphaSierra »

good to know! Thank you

playing with the host to parent is a no brainer for moving your assets around a base
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
Post Reply

Return to “Tech Support”