Newbie questions on LUA scripting.

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Scar79
Posts: 107
Joined: Fri Aug 09, 2013 3:49 pm

Newbie questions on LUA scripting.

Post by Scar79 »

Thx in advance
Scar79
Posts: 107
Joined: Fri Aug 09, 2013 3:49 pm

RE: Is there a way to get a sea floor depth in the given coords?

Post by Scar79 »

Nevermind, solved via World_GetElevation().
Scar79
Posts: 107
Joined: Fri Aug 09, 2013 3:49 pm

RE: Is there a way to get a sea floor depth in the given coords?

Post by Scar79 »

Is it possible to manipulate(destroy, for example) by the launched missile, bomb or torpedo via LUA? Thx in advance
Scar79
Posts: 107
Joined: Fri Aug 09, 2013 3:49 pm

RE: Is there a way to get a sea floor depth in the given coords?

Post by Scar79 »

Please, help, i can't figure out where's the problem: What's wrong with this peice of code?!
local mission=ScenEdit_AddMission('Targets','Surface Target Patrol','patrol',{type='sea'},{zone={'STZ_01','STZ_02','STZ_03','STZ_04'}})
ScenEdit_AssignUnitToMission("Surface Target","Surface Target Patrol")

If i delete {type='sea'} and change mission-class to Support, it works just fine. Obviosly, there is some problem with mission subtype determination, but i can't understand what exactly is wrong.
User avatar
TitaniumTrout
Posts: 472
Joined: Mon Oct 20, 2014 9:06 am
Location: Michigan

RE: Is there a way to get a sea floor depth in the given coords?

Post by TitaniumTrout »

local mission2 = ScenEdit_AddMission('OPFOR','Merchant05A', 'patrol', {type='sea', zone={'RP-1', 'RP-2', 'RP-3'}})

You need to define the zone inside the same set of braces as the type.

<strike>You should be able to destroy a weapon via Lua using .delete .</strike>

local weaponTest = ScenEdit_GetUnit{guid='demuu8-0hlvfim46334n'}

weaponTest:delete()

Scar79
Posts: 107
Joined: Fri Aug 09, 2013 3:49 pm

RE: Is there a way to get a sea floor depth in the given coords?

Post by Scar79 »

ORIGINAL: TitaniumTrout

local mission2 = ScenEdit_AddMission('OPFOR','Merchant05A', 'patrol', {type='sea', zone={'RP-1', 'RP-2', 'RP-3'}})

You need to define the zone inside the same set of braces as the type.

<strike>You should be able to destroy a weapon via Lua using .delete .</strike>

local weaponTest = ScenEdit_GetUnit{guid='demuu8-0hlvfim46334n'}

weaponTest:delete()

local mission2 = ScenEdit_AddMission('OPFOR','Merchant05A', 'patrol', {type='sea', zone={'RP-1', 'RP-2', 'RP-3'}})

You need to define the zone inside the same set of braces as the type.
Thank you very much, TitaniumTrout! It works now!
Post Reply

Return to “Lua Legion”