Adding Groups to a Mission (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


ProdigyofMilitaryPride -> Adding Groups to a Mission (4/27/2021 3:04:58 AM)

I'm planning to use LUA for a Soviet bomber raid on a US carrier group [that's defending the western Iceland from Soviet aggression] after being detected by patrol aircraft near Iceland.
How is it supposed to be done? What strings do I need? What specialized lines of code might be required?




boogabooga -> RE: Adding Groups to a Mission (4/27/2021 4:04:08 AM)

Greetings.

You really should read the manual and practice mission building a little. Experiment.

But to answer your question-

You may not even need Lua at all, or even a scripted event. Is that carrier group the Soviets' only possible target? If so, you could just assign the bombers to an ASuW Strike mission with no specific target. The strike will launch as soon as suitable targets are detected.

Try to get familiar with the C:MO mission system before anything else.




KnightHawk75 -> RE: Adding Groups to a Mission (4/28/2021 5:08:46 PM)

If it's basic you don't need much, maybe 3 lines, the rest you can do with events, depends on how dynamic you need it to be and how dynamic the scene will be though, the more complex and dynamic the more code, but you can cover a lot ground with just a couple lines.

Attached a simple little sample that highlights a basic detection and mission activation, along with a two line action that adds the detected things to premade missions targetlist as it detects each at a certain level. It's just meant to show you what's already built in with nearly no LUA, recon detects ships, ships get added, strike mission begins while more are still being detected.

db488 required v1147.20+
TesRig-AddTargetsToMissionOnDetection-SampleMinimalLua2_posted5009303.zip

As for the specific question of how to add a group to a mission, simple way is a one-liner.
ScenEdit_AssignUnitToMission("SomeUniqueGroupNameHere","TheUniqueStrikeMissionName");
-- If one or neither 'names' are unique in the total scene, but are at least on the side then:
local g = ScenEdit_GetUnit({side="USSR",name="TheGroupNameHere"});
local m = ScenEdit_GetMission('USSR','TheMissionName');
ScenEdit_AssignUnitToMission(g.guid,m.guid)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.578125