butch4343 -> LUA Script Help (11/21/2017 7:23:02 AM)
|
Guys, I am here again begging help with LUA scripts. I have a couple of errors and I cant see where. The first is that I have three routes A/B/C and what I want is a group to randomly be assigned to each route, so the player doesnt know where the enenmy will come from. I stole a script of Baloogan and amended it as I thought fit, the only issue is I want to assign a group and not a unit as he has. math.randomseed( os.time() ) a = math.random(1,10) if a<5 then ScenEdit_AssignUnitToMission(‘Attack Group 1’, ‘Route A’) elseif a>=5 and a<8 then ScenEdit_AssignUnitToMission(‘Attack Group 1’, ‘Route B’) elseif a>=8 then ScenEdit_AssignUnitToMission(‘Attack Group 1’, ‘Route C’) end But I get an error of LUA script execution error : (String Random Assign Group To Mission) 7 Unexpected Character symbol near char 145) My second problem is that I want to re-assign the units an ASW patrol once they reach the straights of dover. I thought using something like: unit = ScenEdit_UnitX() ScenEdit_AssignUnitToMission({unitname=unit.name}, 'Attack Patrol') As this would save me the hassle of having to do lines of script, it would just be whatever units made it that far south. My issue is I get: 03:02:32 - 03:02:32 - Lua script execution error: [string "Soviet Vessels Enter Patrol Box"]:2: invalid arguments to method call Anyone see where my scripting is gone wrong? Regards a Grateful Numpty at LUA
|
|
|
|