RTB Question

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
Gunner98
Posts: 5998
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RTB Question

Post by Gunner98 »

I've got the following script working well but there is something missing:

----Change units to NATO Sp

for i=1,19 do
if ScenEdit_GetUnit({Side='NATO', Name="113rd FS Racers #"..i,}) ~= nil then
ScenEdit_SetUnitSide({Side='NATO', Name="113rd FS Racers #"..i, newside='NATO Sp'})
ScenEdit_SetUnit({side="NATO Sp", unitname="113rd FS Racers #"..i, RTB = True})
ScenEdit_AssignUnitToMission("113rd FS Racers #"..i, "Patrick Ferry")
end
end

So this changes a group of units to a different side after checking that they are still alive. Then they're told to RTB and for added measure set to a ferry mission to their home base.

All this is working but they continue on to their next waypoint before assuming the RTB and Ferry mission. I would like them to turn for home immediately. Not sure how to do that except maybe set up a waypoint next to the base and set the course to that.

Any thoughts

Tx
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: RTB Question

Post by KnightHawk75 »

Are the units in question doctrine set to ignore plotted course=yes, otherwise they may want to finish their waypoint prior to listening to your new commands. It may make little difference for your problem but I'd also recommend putting them in the mission prior to the RTB command. Didn't test, just comes to mind.
User avatar
Gunner98
Posts: 5998
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: RTB Question

Post by Gunner98 »

Thanks KnightHawk I'll give that a go.

Cheers
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
User avatar
Gunner98
Posts: 5998
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: RTB Question

Post by Gunner98 »

OK, ignore plotted course=yes was in place. Changed the order of commands

Same same
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: RTB Question

Post by KnightHawk75 »

ORIGINAL: Gunner98

OK, ignore plotted course=yes was in place. Changed the order of commands

Same same

Code: Select all

local function DoTest()
     local u = ScenEdit_GetUnit({name='Carey Mahoney', guid='4FH7PU-0HM0EBQ3P9U9N'})
     if(u ~=nil) then
         ScenEdit_SetUnitSide({Side='Yellow', Name="Carey Mahoney", newside='Red'})
         ScenEdit_AssignUnitToMission(u.guid, "FerryToTexas") 
         ScenEdit_SetUnit({side="Red", guid=u.guid, RTB = true}) <--
         --u:RTB(true); --this works too.
         print('done');
     end
 end
 DoTest()
 
Worked exactly as expected, immediate RTB.
I think this is a case of case striking again, so easy to miss, use lowercase 't' in true.
ScenEdit_SetUnit({side="NATO Sp", unitname="113rd FS Racers #"..i, RTB = True})

User avatar
Gunner98
Posts: 5998
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: RTB Question

Post by Gunner98 »

That did it![&o]

Thank you very much - need to test my eyes.
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: RTB Question

Post by KnightHawk75 »

We all been there, I bashed my head against a wall for hours over emcon vs emcom thinking something was broke, for whatever reason I couldn't see it over and over again and kept typing it wrong (or cutting and pasting the wrong thing over and over) till someone here pointed out the obvious. DOH!.[;)]

Post Reply

Return to “Lua Legion”