Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

I've been scanning the A2A dispatcher docs but I'm missing it... How where do I set the total number of aircraft available? ie. once say 6 total planes have launched no more will be available?

 

Can someone link me to the "how to" that has that or post the code snip it?

 

Thanks,

 

Sage

 

 

 

This is what I use to set the number of aircraft available to 3 for the Lar squadron.

 

 

A2ADispatcher:SetSquadron( "Lar", "Bandar Abbas Intl", { "Red Squadron" }, 3 )

Link to comment
Share on other sites

I wonder if anyone can help me, I'm trying to dynamically spawn groups in an uncontrolled state and then task them to activate them. It seems to work with E-2s and Reapers but not with any other asset types!

 

I did a trial mission this:

Placed a Yak-40 with group name "YAK40" on the ramp in an uncontrolled state

Placed a Trigger Zone called HoldZone above the unit.

Run the MOOSE framework at missions start followed by this code...

 

local HoldZone = ZONE:New("HoldZone")

local TaskedCS = GROUP:FindByName("YAK40")

local PatrolTask = AI_PATROL_ZONE:New(HoldZone,3000,4000,200,400,"BARO")

PatrolTask:SetControllable(TaskedCS)

TaskedCS:ClearTasks()

PatrolTask:__Start(5)

local REDSelISR = MESSAGE:New("Yak 40 is tasking",10)

REDSelISR:ToAll()

 

I get the message saying that the Yak 40 is tasking, so the script is executing, but the aircraft just sits there.

I can get the result I want by respawning the aircraft and destroying the old one, but I can't use this method in the context of my intended mission.

 

Can anyone help me out here? Again, it works if I make the asset an E-2 or Reaper, using the exact same code. Is it a bug or am I missing something obvious?

 

Thanks.

Link to comment
Share on other sites

Hi, I´m using A2A_Dispatcher to build a CAP an some GCI. Everything works fine, but two functions doesn´t seem to work:

 

 

A2A_Dispatcher:SetDefault(..Squadron..)FuelThreshold(...)

:SetDisengageRadius(...)

 

 

CAPs and GCIs fly and fight like crazy, follow their enemys until they are out of fuel and far far away from homebase. Farther they fly straight into the ememy SAM sites. Can someone confirm this.

Link to comment
Share on other sites

My guess is since the YAK is new this is a DCS bug / issue. Try spawning it in air or something. Maybe it just can't start up from ramp or something silly like that. Wouldn't surprise me in the slightest.

 

I wonder if anyone can help me, I'm trying to dynamically spawn groups in an uncontrolled state and then task them to activate them. It seems to work with E-2s and Reapers but not with any other asset types!

 

I did a trial mission this:

Placed a Yak-40 with group name "YAK40" on the ramp in an uncontrolled state

Placed a Trigger Zone called HoldZone above the unit.

Run the MOOSE framework at missions start followed by this code...

 

local HoldZone = ZONE:New("HoldZone")

local TaskedCS = GROUP:FindByName("YAK40")

local PatrolTask = AI_PATROL_ZONE:New(HoldZone,3000,4000,200,400,"BARO")

PatrolTask:SetControllable(TaskedCS)

TaskedCS:ClearTasks()

PatrolTask:__Start(5)

local REDSelISR = MESSAGE:New("Yak 40 is tasking",10)

REDSelISR:ToAll()

 

I get the message saying that the Yak 40 is tasking, so the script is executing, but the aircraft just sits there.

I can get the result I want by respawning the aircraft and destroying the old one, but I can't use this method in the context of my intended mission.

 

Can anyone help me out here? Again, it works if I make the asset an E-2 or Reaper, using the exact same code. Is it a bug or am I missing something obvious?

 

Thanks.

Link to comment
Share on other sites

This could be a bug currently with Moose. See this issue: https://github.com/FlightControl-Master/MOOSE/issues/851

 

Hi, I´m using A2A_Dispatcher to build a CAP an some GCI. Everything works fine, but two functions doesn´t seem to work:

 

 

A2A_Dispatcher:SetDefault(..Squadron..)FuelThreshold(...)

:SetDisengageRadius(...)

 

 

CAPs and GCIs fly and fight like crazy, follow their enemys until they are out of fuel and far far away from homebase. Farther they fly straight into the ememy SAM sites. Can someone confirm this.

Link to comment
Share on other sites

  • 2 weeks later...

How to detect when RAT spawned instance enters a zone

 

I'm still a completely noob, just testing stuff to see what can be done. In short, I don't know how to get a UNIT object of the spawned RAT units.

 

 

I'm trying to create a mission to intercept random aircrafts. The idea is to spawn random aircraft at random periods from a couple or random zones, and direct them to a couple of random "target zones" inside some bigger "no-fly zones".So, when the RAT aircraft enters any no-fly zone I get a message and I'm tasked to intercept it.

 

As I'm learning, I'm creating this step by step. It works fine when I place a Cessna with a couple of waypoints so it enters the no-fly zone. In lua I declare a UNIT object and find the Cessna. Then I use this object to periodically check if it is inside the zone. But I cannot get it working when I change it to a RAT aircraft. I believe my problem is that I cannot find the right instance of the object, so the condition checking if the aircraft has entered the zone is not been applied to the RAT spawn.

 

This is the code I'm testing:

 

-- Creates the main menu
mainMenu = MENU_COALITION:New(coalition.side.BLUE, "MISSION MENU")
menuRequestRTB = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Request RTB", mainMenu, requestRTB)

-- Get zones
NoFlyZone1 = ZONE:New("No-fly zone 1")
NoFlyZone2 = ZONE:New("No-fly zone 2")
NoFlyZone3 = ZONE:New("No-fly zone 3")
NoFlyZone4 = ZONE:New("No-fly zone 4")

-- Get planes
banditRAT = RAT:New("RATCessna1")
banditRAT:SetCoalitionAircraft("red")
banditRAT:SetDeparture("Spawn 1")
banditRAT:SetDestination("Target zone")
banditRAT:NoRespawn()
banditRAT:Invisible()
banditRAT:Spawn(1)

   trigger.action.outText("ALIAS " .. banditRAT.alias, 10)
--timer.scheduleFunction(getGroup, "RATCessna1", timer.getTime() + 15) 

--bandits[1] = UNIT:FindByName("RATCessna1")
--bandits[1] = GROUP:FindByName("RATCessna1#001")

TEST = UNIT:FindByName("RATCessna1")

if TEST == nil then
   trigger.action.outText("NULL ", 10)
else 
   trigger.action.outText("NOT NULL: ", 10)
end

-- Schedule triggers
MenuScheduler = SCHEDULER:New( nil,  
 function()
   trigger.action.outText("Checking...", 10)
--    for i = 1,table.getn(bandits),1 doç
     if TEST == nil then
       trigger.action.outText("TEST ES NULL", 10)
     end
     
     if TEST:IsInZone(NoFlyZone1) then
     --if bandits[i]:IsPartlyInZone(NoFlyZone1) then
       trigger.action.outText("Is in zone", 10)
       intercept1Menu = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Intercept", mainMenu, intercept1)
       MenuScheduler:Stop()
     else
       trigger.action.outText("Not in zone", 10)
     end
--    end
  end, {}, 20, 15, nil, nil)

 

 

I have also attached a snapshot of the general situation. As you can see, I am testing a RAT flight that departures in a zone already inside the No-fly zone 1, and the destination is "Target zone", over AI Minhab AB.

 

 

What happens is that the spawned Cessna appears in the zone. When I try to find the object and assign it to "TEST" it does find something (the next if is false, TEST is not null). After 20s the scheduled function triggers and TEST is not null, but even though the Cessna is inside the zone, the TEST:IsInZone(NoFlyZone1) condition is always false.

 

 

 

So I believe the problem is that my "TEST" is not referencing the spawned Cessna.

 

 

 

Also, since I'm already asking, I am only using the Github docs as a reference... Are there any more complex documentation? I really miss using Stackoverflow :music_whistling:

 

 

Thank you!

1937037798_Sinttulo.thumb.png.40aabc23c5141c8559614264a969b707.png

Link to comment
Share on other sites

RAT is a subclass of SPAWN so you may be able to use an OnSpawnGroup() function. See the SPAWN documentation on how to do that and then it will be super easy to get the spawned group.

 

I'm still a completely noob, just testing stuff to see what can be done. In short, I don't know how to get a UNIT object of the spawned RAT units.

 

 

I'm trying to create a mission to intercept random aircrafts. The idea is to spawn random aircraft at random periods from a couple or random zones, and direct them to a couple of random "target zones" inside some bigger "no-fly zones".So, when the RAT aircraft enters any no-fly zone I get a message and I'm tasked to intercept it.

 

As I'm learning, I'm creating this step by step. It works fine when I place a Cessna with a couple of waypoints so it enters the no-fly zone. In lua I declare a UNIT object and find the Cessna. Then I use this object to periodically check if it is inside the zone. But I cannot get it working when I change it to a RAT aircraft. I believe my problem is that I cannot find the right instance of the object, so the condition checking if the aircraft has entered the zone is not been applied to the RAT spawn.

 

This is the code I'm testing:

 

-- Creates the main menu
mainMenu = MENU_COALITION:New(coalition.side.BLUE, "MISSION MENU")
menuRequestRTB = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Request RTB", mainMenu, requestRTB)

-- Get zones
NoFlyZone1 = ZONE:New("No-fly zone 1")
NoFlyZone2 = ZONE:New("No-fly zone 2")
NoFlyZone3 = ZONE:New("No-fly zone 3")
NoFlyZone4 = ZONE:New("No-fly zone 4")

-- Get planes
banditRAT = RAT:New("RATCessna1")
banditRAT:SetCoalitionAircraft("red")
banditRAT:SetDeparture("Spawn 1")
banditRAT:SetDestination("Target zone")
banditRAT:NoRespawn()
banditRAT:Invisible()
banditRAT:Spawn(1)

   trigger.action.outText("ALIAS " .. banditRAT.alias, 10)
--timer.scheduleFunction(getGroup, "RATCessna1", timer.getTime() + 15) 

--bandits[1] = UNIT:FindByName("RATCessna1")
--bandits[1] = GROUP:FindByName("RATCessna1#001")

TEST = UNIT:FindByName("RATCessna1")

if TEST == nil then
   trigger.action.outText("NULL ", 10)
else 
   trigger.action.outText("NOT NULL: ", 10)
end

-- Schedule triggers
MenuScheduler = SCHEDULER:New( nil,  
 function()
   trigger.action.outText("Checking...", 10)
--    for i = 1,table.getn(bandits),1 doç
     if TEST == nil then
       trigger.action.outText("TEST ES NULL", 10)
     end
     
     if TEST:IsInZone(NoFlyZone1) then
     --if bandits[i]:IsPartlyInZone(NoFlyZone1) then
       trigger.action.outText("Is in zone", 10)
       intercept1Menu = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Intercept", mainMenu, intercept1)
       MenuScheduler:Stop()
     else
       trigger.action.outText("Not in zone", 10)
     end
--    end
  end, {}, 20, 15, nil, nil)

 

 

I have also attached a snapshot of the general situation. As you can see, I am testing a RAT flight that departures in a zone already inside the No-fly zone 1, and the destination is "Target zone", over AI Minhab AB.

 

 

What happens is that the spawned Cessna appears in the zone. When I try to find the object and assign it to "TEST" it does find something (the next if is false, TEST is not null). After 20s the scheduled function triggers and TEST is not null, but even though the Cessna is inside the zone, the TEST:IsInZone(NoFlyZone1) condition is always false.

 

 

 

So I believe the problem is that my "TEST" is not referencing the spawned Cessna.

 

 

 

Also, since I'm already asking, I am only using the Github docs as a reference... Are there any more complex documentation? I really miss using Stackoverflow :music_whistling:

 

 

Thank you!

Link to comment
Share on other sites

@Darcaem

As far as I know, late activated units spawned via MOOSE script can't be found using UNIT:FindByName or GROUP:FindByName, since it appears their name changes with respect to ME when MOOSE spawns them (might be wrong, though, not 100% sure).

 

Delta's solution (OnSpawnGroup) has worked for me in the past, definitely give it a try.

 

Alternatively, perhaps you could even include the Cessna and the RAT aircraft in a SET_GROUP, then use iterators to run functions specifically directed at them later on (you should have no trouble finding those units then).

 

This is what I do when OnSpawnGroup() is just too tricky to implement in my scripts (too many late activated units/groups to handle individually).

 

As for MOOSE documentation, there's this other source that I use. (Here's the RAT section)

I might be wrong, but I think it's an updated version of the site that you linked.

Don't take my word for it, though!

 

Hope this helps!


Edited by Hardcard
Link to comment
Share on other sites

Thats the development branch of the documentation for MOOSE development code branch. Stuff that is not necessarily released yet. It can be used of course but you need to remember its under change until released.

 

@Darcaem

As far as I know, late activated units spawned via MOOSE script can't be found using UNIT:FindByName or GROUP:FindByName, since it appears their name changes with respect to ME when MOOSE spawns them (might be wrong, though, not 100% sure).

 

Delta's solution (OnSpawnGroup) has worked for me in the past, definitely give it a try.

 

Alternatively, perhaps you could even include the Cessna and the RAT aircraft in a SET_GROUP, then use iterators to run functions specifically directed at them later on (you should have no trouble finding those units then).

 

This is what I do when OnSpawnGroup() is just too tricky to implement in my scripts (too many late activated units/groups to handle individually).

 

As for MOOSE documentation, there's this other source that I use. (Here's the RAT section)

I might be wrong, but I think it's an updated version of the site that you linked.

Don't take my word for it, though!

 

Hope this helps!

Link to comment
Share on other sites

  • 2 weeks later...

What would be the right prefix for PG map, as this is for Cacasus

 

( AIRBASE.Caucasus.Batumi )

 

or is there a template for PG map, as there is for Nevada and Casasus


Edited by Fab

Intel Core i7-6700K Cpu 4.00 GHz OC 4.8 GHz Water Cooled|32 GB DDR4 ram OC| Nvidia RTX 2080Ti| TrustMaster Warthog|Saitek Battle Pro Pedals | Logitec G13| Oculus Rift S :joystick:

 

I´m in for a ride, a VR ride:pilotfly:

https://www.youtube.com/channel/UCBX_-Hml7_7s1dggit_vGpA?view_as=public

Link to comment
Share on other sites

Hi,

problem here with newer versions of MOOSE. Moose Generation Timestamp: 20170518_2056 runs as expected, between this and Timestamp: 20171102_0821 something happend so I cant´t use MOOSE anymore. Syntax??

Everything newer/newest (2.4a 2018-09-11T18:40:22) doesn´t work too.

Also moose demo missions don´t work (age of 3 month, e.g.: SPA-012 - Ground Ops - Multiple Spawns, RAT-001 - Basic).

I´m using DCS 1.5.8.12823.

Who can help?

Files attached - very simple, basic stuff but fun ;-)

 

btw: there are some additional errors in logfile - any ideas how to fix? update/repair dcs already done...

 

Any help appreciated - thanks a lot !

HeliWork013 - running.miz

HeliWork013a - does not run.miz

dcs.log.rar


Edited by ZlinMan

Waiting for the return of: -TLP- -True LAN Play- Multiplayer without permanent internet connection to ED master-server. Plane wishlist: Antonov - AN-2

Link to comment
Share on other sites

What would be the right prefix for PG map

 

 

--- These are all airbases of the Persion Gulf Map:
-- 
-- * AIRBASE.PersianGulf.Fujairah_Intl
-- * AIRBASE.PersianGulf.Qeshm_Island
-- * AIRBASE.PersianGulf.Sir_Abu_Nuayr
-- * AIRBASE.PersianGulf.Abu_Musa_Island_Airport
-- * AIRBASE.PersianGulf.Bandar_Abbas_Intl
-- * AIRBASE.PersianGulf.Bandar_Lengeh
-- * AIRBASE.PersianGulf.Tunb_Island_AFB
-- * AIRBASE.PersianGulf.Havadarya
-- * AIRBASE.PersianGulf.Lar_Airbase
-- * AIRBASE.PersianGulf.Sirri_Island
-- * AIRBASE.PersianGulf.Tunb_Kochak
-- * AIRBASE.PersianGulf.Al_Dhafra_AB
-- * AIRBASE.PersianGulf.Dubai_Intl
-- * AIRBASE.PersianGulf.Al_Maktoum_Intl
-- * AIRBASE.PersianGulf.Khasab
-- * AIRBASE.PersianGulf.Al_Minhad_AB
-- * AIRBASE.PersianGulf.Sharjah_Intl
-- * AIRBASE.PersianGulf.Shiraz_International_Airport
-- * AIRBASE.PersianGulf.Kerman_Airport

Link to comment
Share on other sites

So, a question regarding the Detection class. As per my testing, it seems like the detected status of an aircraft "sticks" even though it goes out of an EWR's scope of detection.

 

In my test I set up a RED EWR network, and AI A2A Dispatcher GCI response range at ~60nm.

I set up a Blue AI Hornet at 20 000ft start alt at ~80nm from target base, and succeeding waypoints from 75nm out, at 100ft AGL towards the target base. I carefully checked that it is terrain masked all the way up to the target.

 

So the EWR detects the Hornet on its way down from 20 000 ft, prior to reaching it's first 100ft AGL waypoint. No GCI response, as it's still out of the GCI range. The Hornet is terrain masked from ~75nm and all the way to the target. However, when passing the GCI range at 60nm, the AI A2A Dispatcher still spawns a GCI fighter when the hornet passes the GCI range at 60nm.

 

IMHO, shouldnt the detection object purge detected aircraft outside of it's scope?

 

To verify that this is in fact the issue, I set the Hornet up at 100ft AGL starting alt and let it fly all the way to target base and it works. No GCI is scrambled since it's never detected by EWR.

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

I believe this was a bug recently fixed and likely available in the development branch of Moose. This is a branch that is NOT officially released yet but you can try it at your own risk. Just make sure you can revert back to what you have now. I believe this will be released officially soon as a stable release.

 

So, a question regarding the Detection class. As per my testing, it seems like the detected status of an aircraft "sticks" even though it goes out of an EWR's scope of detection.

 

In my test I set up a RED EWR network, and AI A2A Dispatcher GCI response range at ~60nm.

I set up a Blue AI Hornet at 20 000ft start alt at ~80nm from target base, and succeeding waypoints from 75nm out, at 100ft AGL towards the target base. I carefully checked that it is terrain masked all the way up to the target.

 

So the EWR detects the Hornet on its way down from 20 000 ft, prior to reaching it's first 100ft AGL waypoint. No GCI response, as it's still out of the GCI range. The Hornet is terrain masked from ~75nm and all the way to the target. However, when passing the GCI range at 60nm, the AI A2A Dispatcher still spawns a GCI fighter when the hornet passes the GCI range at 60nm.

 

IMHO, shouldnt the detection object purge detected aircraft outside of it's scope?

 

To verify that this is in fact the issue, I set the Hornet up at 100ft AGL starting alt and let it fly all the way to target base and it works. No GCI is scrambled since it's never detected by EWR.

Link to comment
Share on other sites

If you are DCS 1.5.8.x you are probably stuck with the version of Moose that is working for you. There were likely big changes that had to be made for Moose to work with DCS 2.5.x that are likely not backwards compatible to 1.5.8. I am surprised anything would work in 1.5.8.

 

Is there a good reason you cannot update to DCS 2.5.x??

 

Hi,

problem here with newer versions of MOOSE. Moose Generation Timestamp: 20170518_2056 runs as expected, between this and Timestamp: 20171102_0821 something happend so I cant´t use MOOSE anymore. Syntax??

Everything newer/newest (2.4a 2018-09-11T18:40:22) doesn´t work too.

Also moose demo missions don´t work (age of 3 month, e.g.: SPA-012 - Ground Ops - Multiple Spawns, RAT-001 - Basic).

I´m using DCS 1.5.8.12823.

Who can help?

Files attached - very simple, basic stuff but fun ;-)

 

btw: there are some additional errors in logfile - any ideas how to fix? update/repair dcs already done...

 

Any help appreciated - thanks a lot !

Link to comment
Share on other sites

Ok, thanks! Ill check that out!

 

EDIT: I don't fully understand github I guess. Which is the "latest" development branch? There are several branches with the word "development" or "develop" in them...

EDIT2: I downloaded the branch "develop" that seem to be it. But there's just an almost empty moose.lua in there. Apparently you have to "build" the moose.lua file for use with DCS yourself from an LDT environment.

Could anyone provide me with a pre-built moose.lua from the lastest dev-branch?

EDIT3: Nevermind. Found it. :doh:


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

If you are DCS 1.5.8.x you are probably stuck with the version of Moose that is working for you. There were likely big changes that had to be made for Moose to work with DCS 2.5.x that are likely not backwards compatible to 1.5.8. I am surprised anything would work in 1.5.8.

 

Is there a good reason you cannot update to DCS 2.5.x??

 

 

Thanks Delta99, only missed a note about changes or incompatibilities. Using 1.5.8 only because its running with lower crash rate in our network. Maybe we will change to 2.5... if there is time.

If anyone knows the last working Moose-version for 1.5.8 please give a hint. Thanks. Have fun ;-)

Waiting for the return of: -TLP- -True LAN Play- Multiplayer without permanent internet connection to ED master-server. Plane wishlist: Antonov - AN-2

Link to comment
Share on other sites

Another usage question.

 

I have a mission with a RED EWR network, detection and AI_A2A_Dispatcher setup with only GCI.

Squadrons set at three airbases with unlimited resources.

Blue task is to capture the airfields RED is using for GCI.

 

What is the correct way to have the Dispatcher stop spawning GCI fighters at an airfield once it goes blue? I've tried setting the squadrons resources to 0 like below example, but that does not work.

I have not found a way to "delete/remove" a squadron, as in "A2ADispatcher:RemoveSquadron("LAR")

 

A2ADispatcher:SetSquadron( "LAR", 'Lar Airbase', { "LAR MIG-23" }, 0)

 

EDIT:

Would a re-init of an existing squadron at a different base overwrite previous squadron settings and hence stop GCI from, in the example, Lar Airbase?

A2ADispatcher:SetSquadron( "LAR", 'Kerman Airport', { "LAR MIG-23" })


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

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...