Page 1 of 1

Newbie questions on LUA scripting.

Posted: Sat May 02, 2020 8:16 pm
by Scar79
Thx in advance

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

Posted: Sat May 02, 2020 10:45 pm
by Scar79
Nevermind, solved via World_GetElevation().

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

Posted: Sun May 03, 2020 9:55 am
by Scar79
Is it possible to manipulate(destroy, for example) by the launched missile, bomb or torpedo via LUA? Thx in advance

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

Posted: Sun May 03, 2020 12:38 pm
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.

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

Posted: Sun May 03, 2020 3:46 pm
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()


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

Posted: Sun May 03, 2020 10:35 pm
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!