Psyrixx Posted May 6, 2013 Posted May 6, 2013 (edited) So I've got two Blackhawk helicopters in my mission that land to pick up a unit. With the 1.2.4 patch, I want to dynamically spawn two soldiers to run over and "verify" or escort the unit back to the helicopters. These guys spawn from Helicopter 1 unless he's been shot down, otherwise they spawn from Helicopter 2. I've got the dynamic spawning working, but I can't for the life of me figure out how to get these guys to run over to the asset. I've been trying the following, but I can't figure out how to get them to start their waypoint path. local rescueName = 'Pontiac 1-1' if(Unit.getByName('Pontiac 1-1'):getLife() < 1) then local rescueName = 'Pontiac 1-2' end local rescue = Unit.getByName(rescueName):getPosition().p local asset = Unit.getByName('Downed Pilot'):getPosition().p local data = { ["taskSelected"] = true, ["route"] = { ["spans"] = { }, -- end of ["spans"] ["points"] = { [1] = { ["alt"] = 10, ["type"] = "Turning Point", ["ETA"] = 0, ["alt_type"] = "BARO", ["formation_template"] = "", ["y"] = asset.z, ["x"] = asset.x - 5, ["ETA_locked"] = false, ["speed"] = 5, ["action"] = "Off Road", ["speed_locked"] = true, }, -- end of [1] }, -- end of ["points"] }, -- end of ["route"] ["visible"] = true, ["groupId"] = "Pontiac Verification Team", ["tasks"] = { }, -- end of ["tasks"] ["hidden"] = false, ["units"] = { [1] = { ["y"] = rescue.z - 4, ["type"] = "Soldier M4", ["name"] = "Verification 1", ["unitId"] = math.random(40, 50), ["heading"] = 0, ["playerCanDrive"] = true, ["skill"] = "Average", ["x"] = rescue.x + 7, }, -- end of [1] [2] = { ["y"] = rescue.z - 6, ["type"] = "Soldier M4", ["name"] = "Verification 2", ["unitId"] = math.random(40, 50), ["heading"] = 0, ["playerCanDrive"] = true, ["skill"] = "Average", ["x"] = rescue.x + 9, }, -- end of [1] }, -- end of ["units"] --["y"] = 650342.85714286, --["x"] = -292285.71428571, ["name"] = string.char(math.random(65,90)), --["start_time"] = 0, --["task"] = "Ground Nothing", } -- end of [1] coalition.addGroup(country.id.USA, Group.Category.GROUND, data) Ideally I'd want two waypoints, one just in front of the target individual with an ALARM_STATE.RED task then after 630 seconds a trigger to set ALARM_STATE.GREEN and the second waypoint pretty much being back where they started. I have the functionality working with a static group in the mission already, but would love to figure out how to handle it dynamically. Totally new to Lua but comfortable with programming. Any help would be much appreciated! Edited May 6, 2013 by Psyrixx Robert Sogomonian | Psyrixx website| e-mail | blog | youtube | twitter
Psyrixx Posted May 7, 2013 Author Posted May 7, 2013 After completely overhauling my code I think I've got something that works wonderfully! Link to new post for anyone wanting to follow: http://forums.eagle.ru/showpost.php?p=1748309&postcount=154 Robert Sogomonian | Psyrixx website| e-mail | blog | youtube | twitter
Sabre-TLA Posted May 7, 2013 Posted May 7, 2013 Very cool. Now all we need is a pilot unit instead of having to use a soldier. Have you tested it with yourself as the bailed out pilot? Would look pretty cool after bailing out to see a chopper land and soldiers run over to rescue you IMHO. Good job! MapleFlagMissions - Read Our Blog for Updates
Psyrixx Posted May 7, 2013 Author Posted May 7, 2013 Very cool. Now all we need is a pilot unit instead of having to use a soldier. Have you tested it with yourself as the bailed out pilot? Would look pretty cool after bailing out to see a chopper land and soldiers run over to rescue you IMHO. Good job! I have not, as my mission is an extraction mission where Blue coalition is running Close Air Support while either Pontiac (blackhawks) or Chevy (user controlled hueys) goes in for a spy who has recently broken deep cover. I don't think it would be too hard to set up what you're proposing, but it would require DCS to be able to see all multiplayer clients ejections points and whether they've moved or not ... something I'm not sure the engine does at the moment. Robert Sogomonian | Psyrixx website| e-mail | blog | youtube | twitter
Recommended Posts