Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Help with changing sides

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Help with changing sides Page: [1]
Login
Message << Older Topic   Newer Topic >>
Help with changing sides - 5/16/2019 2:52:30 AM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline
I am having an issue with the set unit side. Running the following script, only one of the 12 aircraft actually switch sides...not certain why even one would work if there is an issue with the script, but it is always the same one "Vanguard #11"

Below are two separate tries with the LUA responses...attached is the scenario as well...thank you

ScenEdit_SetUnitSide({Side='USN', Name='Cabimas Airfield', newside='Venezuela'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #1', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #1', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #2', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #2', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #3', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #3', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #4', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #4', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #5', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #5', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #6', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #6', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #7', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #7', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #8', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #8', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #9', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #9', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #10', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #10', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #11', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #11', 'Venezuela Intercept'})
ScenEdit_SetUnitSide({Side='USN', Name='Vanguard #12', newside='Venezuela'})
ScenEdit_AssignUnitToMission({'Vanguard #12', 'Venezuela Intercept'})

ERROR: [string "Console"]:3: invalid arguments to method call
>> ScenEdit_SetUnitSide({Side='USN', Name='Cabimas Airfield', newside='Venezuela'})
for i=1,12 do
if ScenEdit_GetUnit({Side='USN', Name="Vanguard #1"..i,}) ~= nil then -- unit # exists
ScenEdit_SetUnitSide({Side='USN', Name="Vanguard #1"..i, newside='Venezuela'}) -- change side
if not ScenEdit_GetSideIsHuman('Venezuela') then -- not human side
ScenEdit_AssignUnitToMission("Venezuela #"..i, "Venezuela Intercept") -- assign mission
end
end
end
ScenEdit_AssignUnitToMission 0 : ,UnitX was not found in the scenario unit list!
>> ScenEdit_SetUnitSide({Side='USN', Name='Cabimas Airfield', newside='Venezuela'})
for i=1,12 do
if ScenEdit_GetUnit({Side='USN', Name="Vanguard #1"..i,}) ~= nil then -- unit # exists
ScenEdit_SetUnitSide({Side='USN', Name="Vanguard #1"..i, newside='Venezuela'}) -- change side
if not ScenEdit_GetSideIsHuman('Venezuela') then -- not human side
ScenEdit_AssignUnitToMission("Vanguard #"..i, "Venezuela Intercept") -- assign mission
end
end
end
ScenEdit_SetUnitSide 0 : ,Can't find Unit 'Cabimas Airfield' on Side 'USN'
>> ScenEdit_SetUnitSide({Side='USN', Name='Cabimas Airfield', newside='Venezuela'})
for i=1,12 do
if ScenEdit_GetUnit({Side='USN', Name="Vanguard #1"..i,}) ~= nil then -- unit # exists
ScenEdit_SetUnitSide({Side='USN', Name="Vanguard #1"..i, newside='Venezuela'}) -- change side
if not ScenEdit_GetSideIsHuman('Venezuela') then -- not human side
ScenEdit_AssignUnitToMission("Vanguard #"..i, "Venezuela Intercept") -- assign mission
end
end
end



Attachment (1)
Post #: 1
RE: Help with changing sides - 5/16/2019 4:24:06 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
in the first section the first error is line 3 - it tells you that in the error:3

problem is that per the docs the function parameters (really called arguments) are not a table - you just pass in the unit name and mission name separated by a comma, inside parens but without the curly brackets so:
ScenEdit_AssignUnitToMission('Vanguard #1','Venezuela Intercept')

all your mission ones need to have the curlies removed then that part should work.

in the other section which is cleaner you have:
------------------------------------------------------
for i=1,12 do
if ScenEdit_GetUnit({Side='USN', Name="Vanguard #1"..i,}) ~= nil then -- unit # exists
ScenEdit_SetUnitSide({Side='USN', Name="Vanguard #1"..i, newside='Venezuela'}) -- change side
if not ScenEdit_GetSideIsHuman('Venezuela') then -- not human side
ScenEdit_AssignUnitToMission("Venezuela #"..i, "Venezuela Intercept") -- assign mission
end
end
end
------------------------------------------------------

first problem is:
ScenEdit_GetUnit({Side='USN', Name="Vanguard #1"..i,}) --this is on two lines, can't have the 1 - should be Name="Vanguard #"..i
you have a 1 hard coded in the name, and are adding the index number to it, which will give you 11,12,13,14,15,15,16,17,18,19,110,111,112 which is why you got #11 to work, but then it chokes on the next line so you don't get #12.

next problem:
ScenEdit_AssignUnitToMission("Venezuela #"..i, "Venezuela Intercept")

the unit name is Vanguard not Venezuela.

Nice work, that looks pretty interesting, haven't seen anything with the ARES AI in it yet I don't think.


< Message edited by Whicker -- 5/16/2019 4:48:05 AM >

(in reply to rmunie0613)
Post #: 2
RE: Help with changing sides - 5/16/2019 1:25:32 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
Ronald,

This format works: ScenEdit_AssignUnitToMission("Spec Ops", "Coalition LZ").

So,it looks the problem is with the "}" inclusion. If you remove those it should work fine.

-Wayne Stiles

(in reply to rmunie0613)
Post #: 3
RE: Help with changing sides - 5/17/2019 2:03:00 PM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline
Thank you guys.. after some hours the lines all are a blur to my eyes lol..it is awesome having helpful extra eyes in this forum!

(in reply to stilesw)
Post #: 4
RE: Help with changing sides - 5/17/2019 2:07:55 PM   
rmunie0613

 

Posts: 202
Joined: 1/2/2018
Status: offline

quote:

ORIGINAL: Whicker

….
Nice work, that looks pretty interesting, haven't seen anything with the ARES AI in it yet I don't think.


The ARES AI (and a horde of other things lol) I am testing in this scenario, which actually began quite tiny but has become my "scenario test tool" for an entire small campaign now.
Thank you.

(in reply to Whicker)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Help with changing sides Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.219