Page 1 of 1
Lua assign mission question
Posted: Sat Sep 05, 2020 5:14 pm
by Gunner98
Hay guys, I've done this a dozen times or more but getting a strange result here - so it's probably fat finger problems as usual.
Testing a lua command to assign units to a mission - it works - sort of. Looking to assign all 8 Helix to a mission but only the last 5 get assigned. See the clip.
Tried several times with minor changes to syntax but result is the same.
Any thoughts?

RE: Lua assign mission question
Posted: Sat Sep 05, 2020 7:58 pm
by michaelm75au
Can you add a save?
All I can think of is that the names aren't correct. That is there is some character in the name of those first 3 you can't see.
RE: Lua assign mission question
Posted: Sat Sep 05, 2020 10:44 pm
by KnightHawk75
That would be my guess as well maybe trailing space in the first 3 units,
or there are other units on side WP with the exact same names that are getting assigned instead?
To test\find either case, esp the later:
Code: Select all
local u;
for i=1,8 do;
u = ScenEdit_GetUnit({Side="WP",Name="38th OShAP #" ..i});
if u ~=nil then
ScenEdit_AssignUnitToMission(u.guid,"SAG ASW");
print('assigned unit named: ' .. u.name .. ' guid: ' ... u.guid);
else
print('Failed to find and assign unit: ' .. '38th OShAP #' .. tostring(i));
end
u = nil;
end
RE: Lua assign mission question
Posted: Sun Sep 06, 2020 7:38 am
by Gunner98
OK that was the problem - duplicate names! Thanks for the quick response and that was a quick fix.
Appreciate the help.