TheThumper Posted June 12, 2018 Posted June 12, 2018 Hello, Need some help with a problem I have not been able to solve. I am building a A2A training mission for myself so that I can learn MOOSE. The Use Case: Using a radio command, spawn an enemy aircraft ~40 miles out in a random direction and altitude that aggressively engages me. I have used the following script to spawn the enemy aircraft: Red_AirplaneTemplate = { "AI_Su-27", "AI_Su-33", "AI_Mig-23", "AI_Mig-29" } Red_AirplaneSpawner = SPAWN:New( "Red_Aircraft" ) :InitLimit( 20, 10 ) :InitRandomizeTemplate(Red_AirplaneTemplate) :InitRandomizeRoute( 1, 1, 20000 ) :InitRandomizePosition( true , 75000, 74000 ) function EnemyAirplaneSpawnFunction ( playerGroup ) playerUnit = UNIT:FindByName(playerGroup:GetName()) MESSAGE:New(playerUnit:GetPlayerName(), 25, "Spawning Enemy Aircraft for" ):ToAll() playerPosition = POINT_VEC3:NewFromVec3(playerUnit:GetVec3()) local y = math.random(500, 7000) playerPosition:SetY(y) EnemyAircraft = Red_AirplaneSpawner:SpawnFromVec3( playerPosition ) end The problem is the spawned aircraft just cruises along about 200 knots and doesn't engage. Once I close to within ~ 5 miles it will engage with heaters (most of the time), but never uses the longer range radar guided missiles (yep, they are loaded). I see the aircraft on my RWR so it is painting me, but doesn't engage from BVR. Skill is set to 'Expert', Task is set to CAP, Advanced Waypoint SetOptions are "Missiles at Max range" and ROE set to 'Weapons Free'. If I use the below code to spawn the aircraft they properly engage with all weapon types, but I lose the ability to spawn aircraft relative to my aircraft: PatrolZone = ZONE:New( "Patrol Zone" ) A2A_Hard = SPAWN:New( "Red_Aircraft" ) :InitLimit( 500, 500 ) :InitRandomizeTemplate( Red_AirplaneTemplate ) :InitRandomizeRoute( 1, 1, 20000 ) function Testing ( playerGroup ) A2A_Hard:SpawnInZone( PatrolZone, true, 5000, 10000 ) end Can anyone clarify what I need to be able to get the aircraft to spawn the way I want, but engage properly please. thanks! ~Thump. Computer Specs: i7-6700K@4.00GHz, 32GB, 850 EVO 1TB, GTX 1080 Ti, Samsung Odyssey VR [sIGPIC][/sIGPIC]
RAF_Raven Posted June 12, 2018 Posted June 12, 2018 (edited) Hello, give this a try Red_AirplaneTemplate = { "AI_Su-27", "AI_Su-33", "AI_Mig-23", "AI_Mig-29" } Red_AirplaneSpawner = SPAWN:New( "Red_Aircraft" ) :InitLimit( 20, 10 ) :InitRandomizeTemplate(Red_AirplaneTemplate) :InitRandomizeRoute( 1, 1, 20000 ) :InitRandomizePosition( true , 75000, 74000 ) :OnSpawnGroup( function (SpawnGroup) Task = SpawnGroup:TaskAttackGroup( playerUnit ) SpawnGroup:PushTask(Task, 5) end ) function EnemyAirplaneSpawnFunction ( playerGroup ) playerUnit = UNIT:FindByName(playerGroup) MESSAGE:New("Spawning Enemy Aircraft for" .. playerUnit:GetPlayerName(), 15):ToAll() playerPosition = POINT_VEC3:NewFromVec3(playerUnit:GetVec3()) local y = math.random(500, 7000) playerPosition:SetY(y) EnemyAircraft = Red_AirplaneSpawner:SpawnFromVec3( playerPosition ) end Edited June 12, 2018 by RAF_Raven
TheThumper Posted June 13, 2018 Author Posted June 13, 2018 Thanks RAF_Raven.... worked like a charm! The trick was to add a task to 'Attack' and then push that task onto the queue. Off to practice! ~Thump. Computer Specs: i7-6700K@4.00GHz, 32GB, 850 EVO 1TB, GTX 1080 Ti, Samsung Odyssey VR [sIGPIC][/sIGPIC]
Delta99 Posted June 13, 2018 Posted June 13, 2018 I think your initRandomizeRoute is killing the ROE options you have set in the editor. Change it to InitRandomizeRoute(0, 0, 20000) My Missions: Valley Patrol Mission :: Valley Escort Mission :: A2A Engagements
Recommended Posts