Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Which MOOSE version do you use, Rudel?

 

Hi .. I'm using version 2.3.0 .. I tried both moose.lua and moose_.lua but both give that briefing message.

 

Like you, it also breaks a bit of immersion to me :)

Best regards

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Which MOOSE version do you use, Rudel?

 

I ask because I also was not fond of that message either since it broke the immersion for me. So it was removed upon my request some time ago - at least if there is no other (moose) briefing text for the mission or even completely, can't recall.

I would love a feature, to "silence" all the MOOSE messages, unless actively set to "show message" xyz for example.

Most of the time we get too much text to read, let alone comprehend while in the middle of flying a plane...

 

Especially the Range script with its wall of text for settings I don't even remotely care about.

 

Most important would be to have message class with the option to delete the older messages added, like in the ME or normal scripting engine messages.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Is there a way to randomize the destination of normal units like you can with cargo carriers or spawning? As in spawn in zone A, B, or C and move to zone X, Y, or Z. I might be missing something obvious but i haven't seen it.

 

Another one i am not sure of is if picking up cargo by command the best way to spawn cargo carriers already loaded?

Link to comment
Share on other sites

i have wirten the script now every thing works like a charm exept the radio transmission.

in a fc3 plane i should hear the transmission without tur to the frequency?!

 

SCHEDULER:New( nil, 
function()

HeloSET = SET_GROUP:New()
:FilterPrefixes("/")
:FilterStart()

CVW17HeloZone = ZONE:New("Helo Enter")
CVW17Ship = UNIT:FindByName("USS Lake Erie")
CVW17ShipRadio = CVW17Ship:GetRadio()
CVW17ShipCoordinate = CVW17Ship:GetCoordinate()

USMCHeloZone = ZONE:New("Helo Enter #001")
USMCShip = UNIT:FindByName("USS Gary")
USMCShipRadio = USMCShip:GetRadio()
USMCShipCoordinate = USMCShip:GetCoordinate()

HeloSET:ForEachGroupCompletelyInZone(CVW17HeloZone, function(HeloSET)

MESSAGE:New("USS Lake Erie: 'You are clear to Land!'",10):ToGroup(HeloSET)
CVW17ShipRadio:NewUnitTransmission("USSOliverPerryHeloLand.ogg", 277, radio.modulation.AM):Broadcast()
CVW17ShipCoordinate:FlareRed()
end
)

HeloSET:ForEachGroupCompletelyInZone(USMCHeloZone, function(HeloSET)

MESSAGE:New("USS Gary: 'You are clear to Land!'",10):ToGroup(HeloSET)
USMCShipRadio:NewUnitTransmission("USSOliverPerryHeloLand.ogg", 231, radio.modulation.AM):Broadcast()
USMCShipCoordinate:FlareRed()
end
)
end, {}, 0, 10
)
trigger.action.outText("Airboss: 'Helo incoming...'", 10)
env.info('Helo Script LOAD SUCCESSFUL... ok')

 

 

can anybody look over my code maybe i made a mistake.

this was my guide:

https://github.com/FlightControl-Master/MOOSE_MISSIONS/blob/master/RAD%20-%20Radio/RAD-002%20-%20Transmission%20Tips%20and%20Tricks/RAD-002%20-%20Transmission%20Tips%20and%20Tricks.lua

Link to comment
Share on other sites

i have wirten the script now every thing works like a charm exept the radio transmission.

I think there is a bug in the MOOSE radio class.

 

To explain briefly, there are two ways in DCS to make a radio transmission. One is via a command and the other is via a trigger. The command has the advantage that you can include a subtitle BUT it only works if the transmitting unit is an air unit.

The trigger works for any unit or even for statics.

 

The MOOSE radio class only checks if the transmission is coming from a unit. If so, it uses the command to broadcast. If the sender is not a unit, it uses the trigger to broadcast.

 

In your case, your naming suggest that you are broadcasting from a ship. So the radio class sees this a a unit and uses the command way to broadcast. And that does not work.

The bug is that the radio class should not only check for a unit but explicitly if the transmitting unit is an aircraft.

 

I just recently did a little work on the radio class because I had the same issue. But it is only in the development branch, which you can download here https://github.com/FlightControl-Master/MOOSE_INCLUDE/tree/develop/Moose_Include_Static

 

In that MOOSE version, the :Broadcast() function has an additional boolean argument. So if you use :Broadcast(true) it will use the trigger way to play the transmission regardless. Then it should also work with ships.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Hi All,

 

Fairly New to Moose, so could use some guidance.

 

I am trying to get a Persistent BAI Mission setup, however, the aircraft goes to the Patrol Zone, and then does not leave for the engagement zone.

 

If I remove the spawn element of the code, then it works fine. So I'm obviously doing something stupid.

 

do

 -- Declare SPAWN objects
Spawn_BAITest = SPAWN:New( "BAI_Test" ):InitKeepUnitNames( true ):InitLimit( 1, 100 ):InitCleanUp( 20 )  

 ---:InitLateActivated( false ):InitUnControlled( false )
 -- Choose repeat functionality
Spawn_BAITest:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Anapa_Vityazevo ), SPAWN.Takeoff.Cold )
         
         
Spawn_BAITest:InitRepeatOnLanding()
 
Spawn_BAITest:SpawnScheduled(30,0)
 

end 



 ---BAI TEST
 
BAIEngagementZone = ZONE:New( "Engagement Zone" )

BAIPlane = GROUP:FindByName( "BAI_Test#001" )


BAI_RANGE_Zone = ZONE:New( "BAI Patrol Zone" )

AIBAIZone = AI_BAI_ZONE:New( BAI_RANGE_Zone, 500, 10000, 500, 600, BAIEngagementZone )

Targets = GROUP:FindByName( "Bomb_Target_AI" )

AIBAIZone:SetControllable( BAIPlane )

AIBAIZone:__Start( 1 ) 

AIBAIZone:__Engage( 1 )

Check, CheckScheduleID = SCHEDULER:New(nil,
 function()
   if Targets:IsAlive() and Targets:GetSize() ~= 0  then
     BASE:E( "Range Mission " .. Targets:GetSize() .. " targets left to be destroyed.")
   else
     BASE:E( "Range Mission: The Target is destroyed." )
     AIBAIZone:__Accomplish( 1 )
   end
 end, {}, 20, 60, 0.4 )


function AIBAIZone:OnAfterAccomplish( Controllable, From, Event, To )
 BASE:E( "Range Mission: Sending the bombers back to base." )
 Check:Stop( CheckScheduleID )
 AIBAIZone:__RTB( 1 )
end

 

 

 

Within the DCS log, I get the following:

 

 

2019-01-02 10:22:38.738 INFO    SCRIPTING:  82079(    -1)/E:         AI_BAI_ZONE01074.function(Not in the air, finding route path within PatrolZone)
2019-01-02 
10:22:39.801 INFO    SCRIPTING:    152(    -1)/E:                BASE00000.function(Range Mission 1 targets left to be destroyed.)

 

Any help is appreciated, as I've been stumped by this for the last few days.

Link to comment
Share on other sites

Elaborate on this because I don't know what this means exactly.

 

Hi Delta99,

 

Sorry, I should have been clearer.

 

If I remove the below code and run purely the BAI script, with the BAI_Test Aircraft placed in the ME. The BAI Script works perfectly.

 

When I introduce the Spawn routine below to the code, the aircraft heads to the patrol zone, and then never departs the Patrol Zone for the engage zone.

 

do

 -- Declare SPAWN objects
Spawn_BAITest = SPAWN:New( "BAI_Test" ):InitKeepUnitNames( true ):InitLimit( 1, 100 ):InitCleanUp( 20 )  

Spawn_BAITest:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Anapa_Vityazevo ), SPAWN.Takeoff.Cold )
        
Spawn_BAITest:InitRepeatOnLanding()
 
Spawn_BAITest:SpawnScheduled(30,0)
 

end 

 

Thanks!

Link to comment
Share on other sites

Rather than doing this:

 

BAIPlane = GROUP:FindByName( "BAI_Test#001" )

 

use an OnSpawnGroup() method of SPAWN to get the group that was just spawned. Then you can use that group in the rest of your code. Most likely "BAI_TEST#001" is not the group name or I think it is created with spaces. In any event, using OnSpawnGroup makes it so you couldn't care or know what the group name actually is that is spawned

 

Hi Delta99,

 

Sorry, I should have been clearer.

 

If I remove the below code and run purely the BAI script, with the BAI_Test Aircraft placed in the ME. The BAI Script works perfectly.

 

When I introduce the Spawn routine below to the code, the aircraft heads to the patrol zone, and then never departs the Patrol Zone for the engage zone.

 

do

 -- Declare SPAWN objects
Spawn_BAITest = SPAWN:New( "BAI_Test" ):InitKeepUnitNames( true ):InitLimit( 1, 100 ):InitCleanUp( 20 )  

Spawn_BAITest:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Anapa_Vityazevo ), SPAWN.Takeoff.Cold )
        
Spawn_BAITest:InitRepeatOnLanding()
 
Spawn_BAITest:SpawnScheduled(30,0)
 

end 

 

Thanks!

Link to comment
Share on other sites

Hi Delta99,

 

I changed the code around as you have suggested - it's a much cleaner way of doing it so thank you.

 

I now get the following error:

 

2019-01-02 22:07:34.609 INFO    SCRIPTING:  34581( 23424)/E:             AIRBASE00808.FindFreeParkingSpotForAircraft(Anapa-Vityazevo: Looking for 1 parking spot(s) for aircraft of size 15.2 m (x=15.2,y=5.1,z=10.2) at termial type 244.)
2019-01-02 22:07:34.609 INFO    SCRIPTING:  34685( 23424)/E:             AIRBASE00808.FindFreeParkingSpotForAircraft(Anapa-Vityazevo: Parking spot id 92 free.)
2019-01-02 22:07:34.615 INFO    SCRIPTING:  10954( 10856)/I:            DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=0,[Group]=BAI_Test#001,[Country]=2,[units]={[1]=BAI_Test#001-01,},})
2019-01-02 22:07:34.619 INFO    SCRIPTING:  10765( 10867)/I:            DATABASE00003.AddGroup({[1]=Add GROUP:,[2]=BAI_Test#001,})
2019-01-02 22:07:35.560 INFO    SCRIPTING: Error in timer function: [string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:20939: attempt to index field 'Controllable' (a nil value)
2019-01-02 22:07:35.560 INFO    SCRIPTING: stack traceback:
[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:5103: in function <[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:5100>
[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:20939: in function '_call_handler'
[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:20702: in function <[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:20612>
(tail call): ?
[C]: in function 'xpcall'
[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:5138: in function <[string "C:\Users\HAMISH~1\AppData\Local\Temp\DCS\/~mis00000370.lua"]:5097>

 

 

New Code

 

do
 -- Declare SPAWN objects
Spawn_BAITest = SPAWN:New( "BAI_Test" )
Spawn_BAITest:InitKeepUnitNames( true )
Spawn_BAITest:InitLimit( 1, 100 )
Spawn_BAITest:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Anapa_Vityazevo ), SPAWN.Takeoff.Cold )
Spawn_BAITest:InitRepeatOnLanding()
Spawn_BAITest:SpawnScheduled(30,0)
Spawn_BAITest:InitCleanUp( 20 ) 
Spawn_BAITest:OnSpawnGroup(
   function( SpawnGroup )
   end)
end 

--BAI TEST
 
BAIEngagementZone = ZONE:New( "Engagement Zone" )
BAIPlane = SpawnGroup
BAI_RANGE_Zone = ZONE:New( "BAI Patrol Zone" )

AIBAIZone = AI_BAI_ZONE:New( BAI_RANGE_Zone, 500, 10000, 500, 600, BAIEngagementZone )
Targets = GROUP:FindByName( "Bomb_Target_AI" )

AIBAIZone:SetControllable( BAIPlane )
AIBAIZone:__Start( 1 ) 
AIBAIZone:__Engage( 1 )

Check, CheckScheduleID = SCHEDULER:New(nil,
 function()
   if Targets:IsAlive() and Targets:GetSize() ~= 0  then
     BASE:E( "Range Mission " .. Targets:GetSize() .. " targets left to be destroyed.")
   else
     BASE:E( "Range Mission: The Target is destroyed." )
     AIBAIZone:__Accomplish( 1 )
   end
 end, {}, 20, 60, 0.4 )

function AIBAIZone:OnAfterAccomplish( Controllable, From, Event, To )
 BASE:E( "Range Mission: Sending the bombers back to base." )
 Check:Stop( CheckScheduleID )
 AIBAIZone:__RTB( 1 )
end

 

Rather than doing this:

 

BAIPlane = GROUP:FindByName( "BAI_Test#001" )

 

use an OnSpawnGroup() method of SPAWN to get the group that was just spawned. Then you can use that group in the rest of your code. Most likely "BAI_TEST#001" is not the group name or I think it is created with spaces. In any event, using OnSpawnGroup makes it so you couldn't care or know what the group name actually is that is spawned

Link to comment
Share on other sites

You need your code inside the OnSpawnGroup function.

 

"SpawnGroup" doesn't exist outside the function and you want that code executed inside the function.

 

Hi Delta99,

 

I changed the code around as you have suggested - it's a much cleaner way of doing it so thank you.

 

I now get the following error:


Edited by Delta99
Link to comment
Share on other sites

You need your code inside the OnSpawnGroup function.

 

"SpawnGroup" doesn't exist outside the function and you want that code executed inside the function.

 

 

Okay, I am getting there slowly, thank you for the guidance so far.

 

The Aircraft now just sits in the Patrol Zone and doesn't head to the engage zone, until it RTBs with low fuel.

 

2019-01-02 22:42:52.549 INFO    SCRIPTING:  82094(    -1)/E:         AI_BAI_ZONE02115.function(In the air, finding route path within PatrolZone)
2019-01-02 22:42:53.192 INFO    SCRIPTING:     31(    -1)/E:                BASE00000.function(Range Mission 1 targets left to be destroyed.)

 

I have attached the .Miz in case it's of any use - I am using Moose 2.4.13

Caus_IADS_BAI.miz

Link to comment
Share on other sites

Does your SetControllable look like this:

 

AIBAIZone:SetControllable( SpawnGroup )

 

Affirm, still getting the same error set.

 

I wasn't sure if it was because i was using Late activation to spawn. But have tried it without, and setting it to false during the SPAWN: declaration to no avail.

 

Update: The First Iteration of BAI_Test still doesn't work, the jet follows the Waypoints defined in the ME, its almost like the BAI script isnt being actioned, nothing in the log file about it. The Second interation and third seem to work they head to the Patrol Zone and then to the Engage zone. Beyond that they seem to be stuck in the patrol zone again.

 

Update 2 I have increased the Start time to 60s, and added in a Patrol zone hold of 300s and it seems to be working well and reliably. Thank you for the help @Delta99 !!!

 

2019-01-02 23:49:11.575 INFO    SCRIPTING:  10954( 10856)/I:            DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=0,[Group]=BAI_Test#001,[Country]=2,[units]={[1]=BAI_Test#001-01,},})
2019-01-02 23:49:11.579 INFO    SCRIPTING:  81980( 22993)/E:         AI_BAI_ZONE01575.ReSpawnFunction(ReSpawn)
2019-01-02 23:49:12.146 INFO    SCRIPTING:  82079(    -1)/E:         AI_BAI_ZONE01575.function(Not in the air, finding route path within PatrolZone)
2019-01-02 23:49:13.834 INFO    SCRIPTING:     31(    -1)/E:                BASE00000.function(Range Mission 1 targets left to be destroyed.)
2019-01-02 23:50:09.385 WARNING LOG: 17 duplicate message(s) skipped.
2019-01-02 23:50:09.385 INFO    SCRIPTING:  82094(    -1)/E:         AI_BAI_ZONE01575.function(In the air, finding route path within PatrolZone)
2019-01-02 23:50:13.723 WARNING LOG: 1 duplicate message(s) skipped.
2019-01-02 23:50:13.723 INFO    SCRIPTING:     31(    -1)/E:                BASE00000.function(Range Mission 1 targets left to be destroyed.)
2019-01-02 23:50:14.024 INFO    SCRIPTING:  82094(    -1)/E:         AI_BAI_ZONE01575.function(In the air, finding route path within PatrolZone)

 

do

 -- Declare SPAWN objects
Spawn_BAITest = SPAWN:New( "BAI_Test" )
Spawn_BAITest:InitKeepUnitNames( true )
Spawn_BAITest:InitLimit( 1, 100 )
Spawn_BAITest:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Anapa_Vityazevo ), SPAWN.Takeoff.Hot, 143, 68  )
Spawn_BAITest:InitRepeatOnLanding()
Spawn_BAITest:SpawnScheduled(30,0)
Spawn_BAITest:InitCleanUp( 20 ) 
Spawn_BAITest:OnSpawnGroup(
   function( SpawnGroup )
   
             ---BAI TEST
         
       BAIEngagementZone = ZONE:New( "Engagement Zone" )
       BAIPlane = SpawnGroup
       BAI_RANGE_Zone = ZONE:New( "BAI Patrol Zone" )
       
       AIBAIZone = AI_BAI_ZONE:New( BAI_RANGE_Zone, 500, 10000, 500, 600, BAIEngagementZone )
       
       Targets = GROUP:FindByName( "Bomb_Target_AI" )
       
       AIBAIZone:SetControllable( SpawnGroup )
       AIBAIZone:__Start( 1 ) 
       AIBAIZone:__Engage( 1 )
       
       Check, CheckScheduleID = SCHEDULER:New(nil,
         function()
           if Targets:IsAlive() and Targets:GetSize() ~= 0  then
             BASE:E( "Range Mission " .. Targets:GetSize() .. " targets left to be destroyed.")
           else
             BASE:E( "Range Mission: The Target is destroyed." )
             AIBAIZone:__Accomplish( 1 )
           end
         end, {}, 20, 60, 0.4 )
       
       
       function AIBAIZone:OnAfterAccomplish( Controllable, From, Event, To )
         BASE:E( "Range Mission: Sending the bombers back to base." )
         Check:Stop( CheckScheduleID )
         AIBAIZone:__RTB( 1 )
       end
   end)
end 


Edited by crazydunc
Updated Outcome
Link to comment
Share on other sites

TaskBombingRunway

 

I'm trying to get AI planes to bomb a runway using MOOSE. However the plane does not seem to accept the task (shows "Nothing" under task in the F10 map) and just lands at the nearest airbase (which is, ironically, usually the airbase I tasked it to bomb :huh:).

 

 

This is the code I'm using:

 

local airGroup = GROUP:FindByName("Airplane")

ab = AIRBASE:FindByName("Gudauta")
-- This works:

-- task = airGroup:TaskAttackMapObject(ab:GetZone():GetVec2())
-- But this doesn't:

task = airGroup:TaskBombingRunway(ab)

airGroup:PushTask(task, 1)

What am I doing wrong?

Link to comment
Share on other sites

I'm trying to get AI planes to bomb a runway using MOOSE. However the plane does not seem to accept the task (shows "Nothing" under task in the F10 map) and just lands at the nearest airbase (which is, ironically, usually the airbase I tasked it to bomb :huh:).

 

I encountered a similar issue last month.

 

Turns out that in order for scripted tasks to work, the relevant AI groups must have a "compatible" role selected in ME (under "TASK" slot, that is).

 

In my case, :TaskAttackGroup() only worked when the relevant AI groups had CAP/CAS roles assigned in ME...otherwise they'd simply ignore the scripted task and RTB.

 

I your case, I'd try assigning CAS / Ground Attack / Runway Attack roles to Airplane group in ME, see if your script works.

(Btw, you can delete the automatically generated waypoint actions if you want, scripted tasks should work regardless, the group's role setting is what really matters).


Edited by Hardcard
Link to comment
Share on other sites

@corvinus

 

I'll give it a go tomorrow, see if I manage to get it working...

 

For now, have you tried using AIRBASE:Find() instead of AIRBASE:FindByName()?

 

From what I see in the MOOSE declaration, AIRBASE:Find() lets the DCS scripting engine find the name of the airbase for you (needs the airbase object reference as parameter, though).

Chances are it won't change anything, but who knows? Scripted tasks are rather touchy :D

 

Anyway, as I said, I'll give it a go tomorrow.


Edited by Hardcard
Link to comment
Share on other sites

@corvinus

 

I have very good news and pretty bad news. :doh:

 

The good news is that, after 3 hours of insanity and despair, I figured it out (I think).

The bad news is that the MOOSE documentation and Moose.lua will probably need to be corrected.

 

1# What I told you earlier about "compatible" roles is correct.

 

I still don't know what's going on, exactly, but if you pick "Nothing" as a task/role, the AI group(s) will simply ignore the scripted task and RTB.

 

During my tests, I've been able to confirm that the following roles/tasks are "compatible" with :TaskBombingRunway() (meaning that they won't interfere with it) :

 

- CAS

- Ground Attack

- Runway Attack

- Anti-Ship Strike

- AFAC

- Pinpoint Strike

 

2# :TaskBombingRunway() REQUIRES that the attacking planes carry UNGUIDED BOMBS or/and HEAVY UNGUIDED ROCKETS (light rockets and guided bombs/missiles won't be used against runways).

If the attacking aircraft carry guided missiles/bombs and/or light rockets only, they'll RTB.

 

NOTE: The target airport can be set to neutral, :TaskBombingRunway() doesn't seem to care.

 

 

3# The MOOSE documentation for :TaskBombingRunway() seems to be incorrect.

#number AttackQty is NOT an optional parameter, it's absolutely required for the controllable(s) to actually perform the attack (btw, the Hoggit Wiki also seems to be incorrect in this regard).

 

I discovered this while scripting the task following the Hoggit Wiki method:

 

 

 

local RunwayTargetID = AIRBASE:FindByName("Name of the airport in ME"):GetID() --Yes, this is still MOOSE, but I'm only using it to get the airbase ID, the rest is all Hoggit method, I swear! ;)

 

local Runway = {}

Runway.runwayId = RunwayTargetID --NOT OPTIONAL!

Runway.weaponType = nil --DCS weapon enumerator. It's optional, if not provided, the AI will use "task compatible" weapons (if available)

Runway.expend = "All" --Expend enumerator, it's a string value! ( "Quarter" / "Two" / "One" / "Four" / "Half" / "All") It's optional, if not provided, the AI will expend all weapons of the SAME TYPE in each attack.

Runway.attackQty = 3 -- NOT OPTIONAL!!! If you fail to provide it, the AI aircraft will RTB!

Runway.direction = nil --OPTIONAL. If not provided, the AI will automatically align with the target runway (default behaviour)

Runway.groupAttack = true --OPTIONAL

 

local RunwayBombingDCS = {id = 'BombingRunway', params = Runway}

Group.getByName("name of the attacking group in ME"):getController():pushTask(RunwayBombingDCS)

 

 

4# In order for :TaskBombingRunway() to work, I've had to modify my Moose.lua (build 2.4.13, the mission version).

 

Line 28070:

 

point = Airbase:GetID(),

 

--change the variable name to

 

runwayId = Airbase:GetID(),

 

 

Line 28075:

 

controllableAttack = ControllableAttack,

 

--change the variable name to

 

groupAttack = ControllableAttack,

 

 

Don't ask me how or why, all I know is that after making these changes, :TaskBombingRunway() started working.

 

 

I'll report this over the MOOSE discord channel, see if the gurus can explain what's going on.

 

Btw, I've attached a couple of versions of my test mission (both of them use the modified Moose.lua)

 

The first version uses the DCS (Hoggit) tasking method, the second version uses the MOOSE tasking method. Both of them work as intended.

 

IMPORTANT NOTE: The task can't be pushed immediately at mission start, otherwise the AI groups will RTB.

They must be allowed to follow their initial waypoints for a few seconds. That's why I've used a scheduled 10 second delay in the attached test missions

 

 

I hope this helped! :thumbup:

Runway Attack test (DCS Tasking Method).miz

Runway Attack test (MOOSE Tasking Method).miz


Edited by Hardcard
Link to comment
Share on other sites

I have set up a mission where I have two AI flights ( Group 1 and Group 2).

I use MOOSE SPAWN to spawn or respawn the groups if they land or are shot down and it works great.

 

 

But now I would like that MOOSE would randomly spawn one of these groups at a time.

For example, if Group 1 is spawned, Group 2 will not spawn. But if Group 1 is killed or lands, MOOSE will again randomly decide to spawn either Group 1 or Group 2.

 

Basically I would like to do this:

 

 

Spawn_Vehicle_1 = SPAWN:New( "Group 1" [b]OR [/b]"Group 2"  ):InitLimit( 4, 10):SpawnScheduled( 600, 0.8 ):InitRepeatOnEngineShutDown()

Can this be done?


Edited by Silvern
Link to comment
Share on other sites

But now I would like that MOOSE would randomly spawn one of these groups at a time.

For example, if Group 1 is spawned, Group 2 will not spawn. But if Group 1 is killed or lands, MOOSE will again randomly decide to spawn either Group 1 or Group 2.

 

The attached MOOSE demo mission (+ script) does what you asked... although it uses quite a few more lines of code :D

 

I've dispensed with :SpawnScheduled( 600, 0.8 ) and InitRepeatOnEngineShutDown(), since they aren't needed to achieve this.

 

I've used :OnSpawnGroup() to handle the DEAD and LAND events for the spawned groups, as well as flag management and cleanup.

 

 

Basically, you have two late activated template groups in ME (2x F5s and 2x F117s)

 

The F5 group will spawn first, then it'll immediately RTB. When it lands (or is destroyed), a flag checker and a randomizer will decide which group to spawn next (50% chance for each group. 1-5 roll = F5 spawn, 6-10 roll = F117 spawn).

I've also included a cleanup routine for the landed aircraft (it'll run after 30 seconds of the LAND event).

 

The F117 group uses the same logic, so it will follow the same steps.

 

This mission is basically an infinite loop: spawn > land > cleanup + randomize next spawn > rinse and repeat...

 

Hope this helps :thumbup:

Conditional Random Respawn.miz

Conditional Random Respawn Test.lua


Edited by Hardcard
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...