KnightHawk75
Posts: 1450
Joined: 11/15/2018 Status: offline
|
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)
Attachment (1)
< Message edited by KnightHawk75 -- 4/28/2021 5:38:33 PM >
|