Mr Nobody Posted October 25, 2023 Posted October 25, 2023 As the title suggests, I'm having a bit of confusing time in regards to this. I'm trying to spawn units via MIST's cloneInZone function, but I'd like to be able to grab the name of the freshly spawned group since I want to add it to a table for tracking various things. The wiki suggests that the function returns the name of the newly generated group, though I'm not entirely sure how to go about accessing this. I tried doing something along the lines of: NewGroupName = mist.cloneInZone('Test Group', {'Spawn Zone'}) to see if the variable "NewGroupName" would be the string of the group's name to no avail. I'm pretty sure I'm barking up the wrong tree trying this (my only experience in lua is throwing myself at DCS stuff until it works) so any help would be greatly appreciated - am I trying to do this the wrong way, is it not possible, alternatives etc? Thanks in advance.
Solution Insonia Posted October 25, 2023 Solution Posted October 25, 2023 (edited) cloneInZone returns the func teleportToPoint() -> func dynAdd(ng) -> returns the "newgroup", a table copy of whatever passing though. which means this table follows this structure: groupData = { ["visible"] = , ["taskSelected"] = , ["route"] = { }, -- end of ["route"] ["groupId"] = , ["tasks"] = { }, -- end of ["tasks"] ["hidden"] = , ["units"] = { [1] = { }, -- end of [1] }, -- end of ["units"] ["y"] = , ["x"] = , ["name"] = "", ["start_time"] = , ["task"] = "", } So the name is "NewGroupName.name" Edited October 25, 2023 by Insonia 1
Mr Nobody Posted October 25, 2023 Author Posted October 25, 2023 (edited) On 10/25/2023 at 11:44 PM, Insonia said: cloneInZone returns the func teleportToPoint() -> func dynAdd(ng) -> returns the "newgroup", a table copy of whatever passing though. which means this table follows this structure: [...] So the name is "NewGroupName.name" Thanks for the quick reply, that's got me on the right path. Appreciate it! I should add as an aside for anyone from the future with the same problem as me: I used NewGroupName = mist.cloneInZone('Test Group', {'Spawn Zone'}).name to get the group name in this example, rather than "NewGroupName.name". Not sure if that makes a difference in terms of syntax or causing anything to fall apart in certain situations but it's been working flawlessly so far. Edited October 26, 2023 by Mr Nobody extra info
Zyll Posted October 25, 2023 Posted October 25, 2023 The doco should be updated for this. I assume you were looking at the hoggitworld wiki. Anyone know how we go about suggesting a change?Zyll @ TAW
Recommended Posts