Qazplm Posted October 13 Posted October 13 Hey, guys! When I use this code to obtain the coordinates of a unit, it returns nil. What's the problem here? local tank = Unit.getByName('Tank') local coord= tank:getPoint() trigger.action.smoke(coord,trigger.smokeColor.Blue) The prompt "getPoint" is empty and getName() getLife() getPoint....... thank you,
Tobias00723 Posted October 14 Posted October 14 i would recommend taking a look here -> Unit.getByName() can return nil if the name provided does not exist so a unit named 'Tank' does not exist in the mission DCS Mission Scripting Wizard | TGFB Owner | Dev of HIP Dynamic Server | Maker of TGFB Dynamic | tgfb-dcs.com | Contact me | TGFB Discord
Qazplm Posted October 14 Author Posted October 14 7小时前,Tobias00723说: i would recommend taking a look here -> Unit.getByName() can return nil if the name provided does not exist so a unit named 'Tank' does not exist in the mission Thank you! I want to obtain a data list of a unit or group, which includes its name, mount, task, coordinates, etc. How should it be done? Which function should be used? I didn't find the relevant function.
Solution kira_mikamy Posted October 14 Solution Posted October 14 (edited) Unit.getByName("Tank") → here "Tank" must be the Unit name, not the Group name. Group.getByName("Tank") → use this only if the Group is named "Tank" in the Mission Editor. I’m guessing the issue is that your unit might already be named "Tank". If that’s the case, let me know so we can fix it properly. Edited October 14 by kira_mikamy syntax
Qazplm Posted October 15 Author Posted October 15 5小时前,kira_mikamy说: Unit.getByName("Tank") → here "Tank" must be the Unit name, not the Group name. Group.getByName("Tank") → use this only if the Group is named "Tank" in the Mission Editor. I’m guessing the issue is that your unit might already be named "Tank". If that’s the case, let me know so we can fix it properly. Yes, I think I must have confused "unit" with "group"
Qazplm Posted October 15 Author Posted October 15 12小时前,kira_mikamy说: Unit.getByName("Tank") → here "Tank" must be the Unit name, not the Group name. Group.getByName("Tank") → use this only if the Group is named "Tank" in the Mission Editor. I’m guessing the issue is that your unit might already be named "Tank". If that’s the case, let me know so we can fix it properly. Hello, buddy. I want to obtain a template for a unit or group, then modify the name and activate it into a new unit. How should I do it?
Tobias00723 Posted October 15 Posted October 15 (edited) Unless you want to spend ~3 months of your life making your own system there are function in mist that your can use : https://wiki.hoggitworld.com/view/MIST_cloneGroup is one of them if you explicitly want a different group name you can ticker with mist but dont really see the use of it here because Group:getName() Unit:getName() are valid functions you can use.... Edited October 15 by Tobias00723 1 DCS Mission Scripting Wizard | TGFB Owner | Dev of HIP Dynamic Server | Maker of TGFB Dynamic | tgfb-dcs.com | Contact me | TGFB Discord
kira_mikamy Posted October 16 Posted October 16 Il 15/10/2025 at 13:38, Qazplm ha scritto: Hello, buddy. I want to obtain a template for a unit or group, then modify the name and activate it into a new unit. How should I do it? Can you use MOOSE? If not, I recommend moving to it. MOOSE has a function called SpawnNewWithAlias that lets you spawn a group from a Mission Editor template and give it any name (alias) you want each time you spawn it. https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Spawn.html##(SPAWN).NewWithAlias 1
Recommended Posts