Page 1 of 1
LUA to delete a group of units?
Posted: Tue Feb 27, 2018 4:59 am
by hellfish6
I'd like to be able to delete an airbase and its defenses, which are grouped together, when an amphibious assault force arrives in an area. Is it possible to do a LUA to delete the whole group, or do I have to delete each and every component?
Thanks
RE: LUA to delete a group of units?
Posted: Wed Feb 28, 2018 5:03 am
by michaelm75au
You should be able. The default mode of ScenEdit_DeleteUnit() is to do one unit.
There is an option on the command to do all units in the group
ScenEdit_DeleteUnit( {table} , true) --- the 'true' should take all the units. [This should be in the current build as it was added during 1.13]
RE: LUA to delete a group of units?
Posted: Wed Feb 28, 2018 4:15 pm
by hellfish6
So in the table to I need to list each component unit or just the name of the group?
RE: LUA to delete a group of units?
Posted: Thu Mar 01, 2018 5:55 am
by michaelm75au
To delete a group 'mygroup'
ScenEdit_DeleteUnit( {side='myside', name='mygroup'} , true)
RE: LUA to delete a group of units?
Posted: Fri Mar 02, 2018 1:17 am
by hellfish6
Awesome. Thank you very much.
RE: LUA to delete a group of units?
Posted: Fri Mar 02, 2018 11:31 am
by AlphaSierra
I have a Group that I use to teleport units to "randomize it's starting point.
Each unit in the Group has a mission.
I can manually delete/dissolve the group during play (by selecting the group then delete key) causing each unit to "steer" on it's mission.
How can I dissolve the group but maintain the units?
Thank you.
RE: LUA to delete a group of units?
Posted: Fri Mar 02, 2018 12:05 pm
by michaelm75au
Just clear the group on the unit.
unit = SE_GetUnit(...)
unit.group =''
ORIGINAL: AlphaSierra
I have a Group that I use to teleport units to "randomize it's starting point.
Each unit in the Group has a mission.
I can manually delete/dissolve the group during play (by selecting the group then delete key) causing each unit to "steer" on it's mission.
How can I dissolve the group but maintain the units?
Thank you.
RE: LUA to delete a group of units?
Posted: Fri Mar 02, 2018 6:02 pm
by AlphaSierra
Great Idea Thanks