Death Merchant Posted July 25, 2023 Share Posted July 25, 2023 Greetings coding gurus, I am trying to use the mist.dynAdd function to spawn an Mi-24P and load a route so that it will follow a convoy based on a Unit ID. The helo is spawning properly but doesn't seem to load the route properly, it is also spawned with empty pylons for some reason. After spawning I use Route = mist.getGroupRoute("Escort-2", true) to try to grab the route and output it via BASE:E(Route) but this error message: 2023-07-25 11:29:59.528 ERROR SCRIPTING (Main): MIST|getGroupRoute|8171: Escort-2 not found in mist.DBs.MEgroupsByName Here is the code I am using. I figure there is a problem with the tables I have created. local EscortUnits = { [1]= { ['alt']=361.97297275484, ['point']= { ['y']=74360.971148126, ['x']=8926.4008762495, }, ['alt_type']='BARO', ['livery_id']='af 440 ovp', ['onboard_num']='016', ['category']='helicopter', ['unitName']='Escort-2-1', ['AddPropAircraft']= { ['TrackAirTargets']=true, ['SimplifiedAI']=false, ['ExhaustScreen']=true, ['PilotNVG']=true, ['GunnersAISkill']=90, ['R60equipment']=true, ['OperatorNVG']=true, }, ['type']='Mi-24P', ['country']='russia', ['psi']=-0.4111427285092, ['groupId']= HeloGroupID, ['groupName']='Escort-2', ['skill']='High', ['coalition']='red', ['x']=8926.4008762495, ['payload']={ ['pylons']={ [1]={['CLSID']={'2x9M220_Ataka_V'}}, [2]={['CLSID']={'APU-60-1_R_60M'}}, [5]={['CLSID']={'APU-60-1_R_60M'}}, [6]={['CLSID']={'2x9M220_Ataka_V'}}, }, }, ['callsign']='107', ['heading']=5.1035771188166, ['unitId']=292, ['y']=74360.971148126, ['countryId']=0, ['speed']=11.669422301483, }, } local EscortRoute = { [1] = { ["alt"] = 500, ["type"] = "TakeOffGroundHot", ["action"] = "From Ground Area Hot", ["alt_type"] = "BARO", ["form"] = "From Ground Area Hot", ["y"] = 74367.382190126, ["x"] = 8872.6877408358, ["speed"] = 41.666666666667, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { [1] = { ["enabled"] = true, ["key"] = "CAS", ["id"] = "EngageTargets", ["number"] = 1, ["auto"] = true, ["params"] = { ["targetTypes"] = { [1] = "Helicopters", [2] = "Ground Units", [3] = "Light armed ships", }, ["priority"] = 0, }, }, [2] = { ["enabled"] = true, ["auto"] = false, ["id"] = "Follow", ["number"] = 2, ["params"]= { ["lastWptIndexFlagChangedManually"] = true, ["groupId"] = GroupID, ["lastWptIndex"] = 2, ["lastWptIndexFlag"] = true, ["pos"]= { ["y"] = 457.2, ["x"] = -76.2, ["z"] = 200, }, }, }, }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] }, -- end of [1] } vars = { units = EscortUnits, country = 0, category = 'helicopter', groupName = 'Escort-2', groupID = GroupID + 1, clone = false, route = EscortRoute, } mist.dynAdd(vars) Route = mist.getGroupRoute("Escort-2", true) BASE:E("##### Escort-2 Route #####") BASE:E(Route) heloAdded = true BASE:E(heloAdded) Thanks for the help, DM [PC] ASUS X570E - Ryzen 9 5950X - RX 6900 XT - 32GB 3600Mhz Hornet, A-4E-C, Huey, Ka-50, Mi-8, F-15E, F-14 Join us on Death Dealers PvE server. Link to comment Share on other sites More sharing options...
Death Merchant Posted July 25, 2023 Author Share Posted July 25, 2023 The Helo is spawning with the Unit Name Escort-1, but with the Group Name RUSSIA hel 1. I'm looking for more examples of the tables needed to use this function, but I'm not finding much. I've updated the units table: local EscortUnits = { [1]= { ['alt']=361.97297275484, ['alt_type']='BARO', ['livery_id']='af 440 ovp', ['skill']='High', ['ropeLength']=15, ['speed']=11.669422301483, ['AddPropAircraft']= { ['TrackAirTargets']=true, ['SimplifiedAI']=false, ['ExhaustScreen']=true, ['PilotNVG']=true, ['GunnersAISkill']=90, ['R60equipment']=true, ['OperatorNVG']=true, }, ['type']='Mi-24P', ['unitId']=HeloUnitID, ['psi']=-0.4111427285092, ['x']=8926.4008762495, ['y']=74360.971148126, ['unitName']='Escort-2-1', ['groupName']='Escort-2', ['payload']={ ['pylons']={ [1]={['CLSID']={'2x9M220_Ataka_V'}}, [2]={['CLSID']={'APU-60-1_R_60M'}}, [5]={['CLSID']={'APU-60-1_R_60M'}}, [6]={['CLSID']={'2x9M220_Ataka_V'}}, }, ['fuel']=1701, ['flare']=192, ['ammo_type']=1, ['chaff']=0, ['gun']=100, ['restricted']={}, }, ['onboard_num']='016', ['callsign']='107', ['heading']=5.1035771188166, ['point']= { ['y']=74360.971148126, ['x']=8926.4008762495, }, ['category']='helicopter', ['country']='russia', ['groupId']= HeloGroupID, ['coalition']='red', ['countryId']=0, }, } It's still not working. [PC] ASUS X570E - Ryzen 9 5950X - RX 6900 XT - 32GB 3600Mhz Hornet, A-4E-C, Huey, Ka-50, Mi-8, F-15E, F-14 Join us on Death Dealers PvE server. Link to comment Share on other sites More sharing options...
Recommended Posts