Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

trying to capture scenery objects

 

I'm trying to capture scenery objects in a zone but getting no joy.

 

the following returns "Scenery count: 0" no matter where the zone is placed or how big it is...

 

 

Zone = ZONE:New( "Zone" )

 

Zone:Scan( Object.Category.SCENERY )

 

Scenery_Count = #Zone:GetScannedScenery()

 

MESSAGE:New( "Scenery count: " .. Scenery_Count, 60):ToAll()

 

 

can anybody see the error?

Link to comment
Share on other sites

is it me or is AI_CAP_ZONE and AI_CAS_ZONE broken right now. I had them working fine but I think the new update stopped them.

 

I think you are right Hamburgler. I've tried my missions without updating MOOSE and they all seem to be broken as I use AI_CAP_ZONE and AI_BALANCER pretty heavily. Its the stupid parking space and airbase nonsense that ED keeps trying to fix (or break)!!

 

I've notified FC on Discord and likely need to create a GitHub issue. Although this is an example of one thing that Moose and other frameworks have to keep on working around until ED actually fixes things themselves. All this extra work coding around stuff that should work.

Link to comment
Share on other sites

Hey all,

 

I've been trying to get MOOSE to work with no luck so far. Got the "moose.lua" file at the start of this thread and followed the first tutorial, this one :

Nothing happens.

 

So I decided to have a look at the log and I've got this error (for tests purposes the only script loaded is Moose.lua@mission start, nothing else)

 

"

2018-06-04 22:31:09.550 INFO SCRIPTING: *** MOOSE GITHUB Commit Hash ID: 2018-04-14T05:30:11.0000000Z-38622fa8d5b66376cedd502194ca7d149508a99b ***

2018-06-04 22:31:09.550 INFO SCRIPTING: *** MOOSE STATIC INCLUDE START ***

2018-06-04 22:31:09.550 INFO SCRIPTING: Init: Scripts Loaded v1.1

2018-06-04 22:31:09.550 ERROR DCS: Mission script error: : [string "C:\Users\Flogas\AppData\Local\Temp\DCS\/~mis00005D8F"]:5387: table index is nil

stack traceback:

[C]: ?

[string "C:\Users\Flogas\AppData\Local\Temp\DCS\/~mis00005D8F"]:5387: in main chunk

"

 

Line 5387 of the "moose.lua" file is a table initialization using some DCS values (I think) as keys. One of these keys - S_EVENT_MARK_ADDED - does not exist in my DCS it seems :

"

[world.event.S_EVENT_MARK_ADDED] = {

Order = 1,

Side = "I",

Event = "OnEventMarkAdded",

Text = "S_EVENT_MARK_ADDED"

},

"

 

Anybody has any idea why this happens ? Is it a problem with my DCS install ? Is Moose broken following a DCS update ? Am I missing something ?

 

Thanks :)

Toutes les grandes personnes ont d'abord été des enfants, mais peu d'entre elles s'en souviennent.

 

Three Point Landing

Link to comment
Share on other sites

McCallaway, what DCS version are you running exactly?

 

The S_EVENT_MARK_ADDED was added in DCS 2.5.1 and requires MOOSE 2.3.1 or higher.

If your DCS version is <2.5.1 (i.e. current stable) you need to use MOOSE 2.3.0 or lower.

 

All MOOSE versions can be found here https://github.com/FlightControl-Master/MOOSE/releases

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

McCallaway, what DCS version are you running exactly?

 

The S_EVENT_MARK_ADDED was added in DCS 2.5.1 and requires MOOSE 2.3.1 or higher.

If your DCS version is <2.5.1 (i.e. current stable) you need to use MOOSE 2.3.0 or lower.

 

All MOOSE versions can be found here https://github.com/FlightControl-Master/MOOSE/releases

 

Thanks funkyfranky, I know I'm running latest stable and I probably got the latest MOOSE also so that's probably it. I'll try it again tonight.

Toutes les grandes personnes ont d'abord été des enfants, mais peu d'entre elles s'en souviennent.

 

Three Point Landing

Link to comment
Share on other sites

It looks like you are running v1.1 if I am reading the log right which is very old.

 

Well, I don't what this log means but it's in Moose 230 and 231.

env.info(( 'Init: Scripts Loaded v1.1' ))

 

As well as this, in both versions :

-- don't change these

routines.majorVersion = 3

routines.minorVersion = 3

routines.build = 22

 

Still, funkyfranky is right, I was using 231 with DCS 2.5.0 which is not ok. I tried with 230 and it works.

 

Again thank you very much, I was really lost with that and did not seem to find any info anywhere !

Toutes les grandes personnes ont d'abord été des enfants, mais peu d'entre elles s'en souviennent.

 

Three Point Landing

Link to comment
Share on other sites

That must be left over stuff. The best to look at is this line which I missed initially as I thought it came AFTER the Moose loading line:

 

2018-06-04 22:31:09.550 INFO SCRIPTING: *** MOOSE GITHUB Commit Hash ID: 2018-04-14T05:30:11.0000000Z-38622fa8d5b66376cedd502194ca7d149508a99b ***

 

Well, I don't what this log means but it's in Moose 230 and 231.

env.info(( 'Init: Scripts Loaded v1.1' ))

 

As well as this, in both versions :

-- don't change these

routines.majorVersion = 3

routines.minorVersion = 3

routines.build = 22

 

Still, funkyfranky is right, I was using 231 with DCS 2.5.0 which is not ok. I tried with 230 and it works.

 

Again thank you very much, I was really lost with that and did not seem to find any info anywhere !

Link to comment
Share on other sites

Seen it happens here too.

Wow, such landing, much no gear, so slide...

 

T.16000M FCS HOTAS

Owned : Flaming Cliff 3 | Mig-21Bis | AJS-37 Viggen | F/A-18C | F-5E | Mirage 2000c | F-14B | Ka-50 | JF-17

Wishlist : F-4 | Mi-24 | MiG-23 | F-15E | F-16

Dev. Wishlist : Tornado | Mirage F1 | MiG-25 | F-104 | Étendard/Super Étendard | Saab 35 Draken | JAS-39 Gripen A

Link to comment
Share on other sites

I think that once you get the MOOSE version of a unit (UNIT:FindByName) you can then use the CONTROLLABLE:GetDetectedTargets function to find what the unit has detected because Units inherit from Controllable.

 

You can pass GetDetectedTargets a parameter to make it only return targets that are detected visually.

GetDetectedTargets returns nil when the unit is player-controlled.

 

:helpsmilie:I want to make a FAC Gazelle mission too. Please help.

Link to comment
Share on other sites

GetDetectedTargets returns nil when the unit is player-controlled.

:helpsmilie:I want to make a FAC Gazelle mission too. Please help.

It's not possible because a player controlled unit does not automatically detect targets. Only AI do. That's why the detection class is only working for AI units.

 

You might want to create an AI wingman how then detects the targets. There is also an escort class in MOOSE that does what you want :)

https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/Escort.html

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

It's not possible because a player controlled unit does not automatically detect targets. Only AI do. That's why the detection class is only working for AI units.

 

You might want to create an AI wingman how then detects the targets. There is also an escort class in MOOSE that does what you want :)

https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/Escort.html

 

BUT, ED could potentially do this because they do it currently for FOW purposes. So it is modelled and done just not exposed via the same API call I guess. I think it is likely also that a player controlled unit is not technically a controllable (or is it)?

Link to comment
Share on other sites

Hi guys, i have the following for setting up a basic EWR/GCI.

 

 

-- Define OPFOR EWR net
-- Object var name set as prefix within editor
OPFOR_EWRGroup = SET_GROUP:New()
OPFOR_EWRGroup:FilterPrefixes( { "EWRIRAN" } )
OPFOR_EWRGroup:FilterStart()

-- Define EWR group as monitored air space
OPFOR_AirSpace = DETECTION_AREAS:New( OPFOR_EWRGroup, 60000 )

-- Init A2A controller
OPFOR_A2A_Dispatcher = AI_A2A_DISPATCHER:New( OPFOR_AirSpace )

-- Debug -- Enable Tac Display
OPFOR_A2A_Dispatcher:SetTacticalDisplay( true )

-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly 
-- without an assignment within 100km radius from a detected target, will engage that target.
OPFOR_A2A_Dispatcher:SetEngageRadius()

-- Setup OPFOR sqn
OPFOR_A2A_Dispatcher:SetSquadron( "OPFOR_Bandar_Abbas", "Bandar Abbas Intl", { "IRANMIG21","IRANMIG29","IRANF5" }, 20 )
OPFOR_A2A_Dispatcher:SetSquadron( "OPFOR_Tunb_Island_AFB", "Tunb Island AFB", { "IRANMIG21","IRANF5" }, 20 )
OPFOR_A2A_Dispatcher:SetSquadron( "OPFOR_Lar_Airbase", "Lar Airbase", { "IRANMIG21","IRANMIG29","IRANF5" }, 20 )

-- Setup the Takeoff methods
OPFOR_A2A_Dispatcher:SetSquadronTakeoffFromParkingHot( "OPFOR_Bandar_Abbas" )
OPFOR_A2A_Dispatcher:SetSquadronTakeoffFromParkingHot( "OPFOR_Tunb_Island_AFB" )
OPFOR_A2A_Dispatcher:SetSquadronTakeoffFromParkingHot( "OPFOR_Lar_Airbase" )

-- Setup the Landing methods
OPFOR_A2A_Dispatcher:SetSquadronLandingAtEngineShutdown( "OPFOR_Bandar_Abbas" )
OPFOR_A2A_Dispatcher:SetSquadronLandingAtEngineShutdown( "OPFOR_Tunb_Island_AFB" )
OPFOR_A2A_Dispatcher:SetSquadronLandingAtEngineShutdown( "OPFOR_Lar_Airbase" )

-- GCI Squadron execution.
OPFOR_A2A_Dispatcher:SetSquadronGci( "OPFOR_Bandar_Abbas", 900, 1200 )
OPFOR_A2A_Dispatcher:SetSquadronGci( "OPFOR_Tunb_Island_AFB", 900, 1200 )
OPFOR_A2A_Dispatcher:SetSquadronGci( "OPFOR_Lar_Airbase", 900, 1200 )

Is it possible to add defined cap zones into this? So i could access the squadrons and ewr detection, but have seperate cap flights that spawn then patrol a defined area, then engage based on the detection zone.

 

 

I'm still trying to learn MOOSE atm and am generally copy pasting code fragments and seeing what works.


Edited by Shadow.D.
Link to comment
Share on other sites

Is it possible to add defined cap zones into this? So i could access the squadrons and ewr detection, but have seperate cap flights that spawn then patrol a defined area, then engage based on the detection zone.

 

Yes you can do so pretty easily by defining CAP Zone(s) and assigning units from templates you defined before or even new ones. Note that MOOSE will be assigning interception tasks smartly, for example GCI will not takeoff if a CAP is already airborne and in range to deal with the threat.

 

-- Setup CAP Zone: put an airborne unit late activated named "IRCAP West" or whatever you want in your ME and draw a zone with waypoints.
IRCAPWEST = ZONE_POLYGON:New( "IRCAP West", GROUP:FindByName( "IRCAP West" ) )

-- CAP Parameters: setup your CAP, for example:
OPFOR_A2A_Dispatcher:SetSquadronCap( "OPFOR_Bandar_Abbas", IRCAPWEST, 2000, 10000, 600, 800, 800, 1200, "BARO" )
-- Here I basically say: I want a CAP composed of planes of OPFOR_Bandar_Abbas squadron template in the IRCAPWEST, minAlt 2000m maxAlt 10'000m patrolMinSpeed 600kmh patrolMaxSpeed 800 kmh interceptMinSpeed 800kmh interceptMaxSpeed 1200hmh altType Barometric.

-- Then I setup the CAP interval, here I say that I want a max of two CAPs in the zone then I setup the minimum and maximum time boundary in seconds when a new CAP will be spawned with 50%  chance. Note this line is optional, default maxCap is 1.
OPFOR_A2A_Dispatcher:SetSquadronCapInterval( "OPFOR_Bandar_Abbas", 2, 180, 600, 0.5 )

 

Check https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/AI_A2A_Dispatcher.html for detailed description of every function and parameters, tutorials and video playlist. This module is very well documented thanks to FlightControl and the Moose team :)

Badoo 4 | iPod

Link to comment
Share on other sites

Thanks alot kaymelkan.

 

 

Yeah i'm reading through documentation when i need something specific, then looking at the template missions for each case which i think i might need to use. Its just the putting it all together part that is catching me out.

Link to comment
Share on other sites

Follow up question for anyone, does the amount of EWR units defined in the array, affect peformance in anyway?

 

 

i.e is MOOSE doing more calculations if i have 8 EWR units as opposed to 2.

Link to comment
Share on other sites

It certainly will because it requires more computational power I guess.

Although I found it is quite negligible.

 

Go to your DCS.log, it should display how much CPU scripting is using in %. Note that this is a relative number so it can get high if you run the mission for a too short period of time, especially if you have a lot of units spawning at the beginning (like RAT does).

 

I use RAT (quite heavily), AI2ADispatch & Spawn, and performance are not affected throughout the mission. At launch I may have a long freeze when RAT spawns all the traffic but mainly because I am running on HDD and textures take time to load.


Edited by kaymelkan

Badoo 4 | iPod

Link to comment
Share on other sites

this is my 3rd day on learning MOOSE and I am really impressed of how much this platform made our life easier. Thanks to the author and all contributors for this achievement.

 

I have two inquiry; first I have a tanker that will spawn at start then whenever it lands (no fuel) it will re-spawn again (it simulate refueling and fly again).

In case it was shot down, new group will spawn.

 

Now talking about limits, I want total limit of 3 tankers, however I want :InitRepeatOnEngineShutDown() not to be counted in this limit. How could I achieve this?

 

this is my code:

 

-- Create Spawn object
SpawnTanker = SPAWN
 :New('Tanker')
 :InitLimit(1,3)
 :InitRepeatOnEngineShutDown()
 :OnSpawnGroup(
   function( SpawnGroup )
     SpawnGroup:HandleEvent( EVENTS.Crash )
     function SpawnGroup:OnEventCrash(EventData)
SpawnTanker:Spawn()
     end
   end
 )

-- Spawn first Tanker
SpawnTanker:Spawn()

 

what in my mind is to do it manually by deleting :InitRepeatOnEngineShutDown() and using HandleEvent of landing. Something like this:

 

-- Create Spawn object
SpawnTanker = SPAWN
 :New('Tanker')
 :OnSpawnGroup(
   function( SpawnGroup )
     -- Recrod spawn Index
     local GroupPlane, Index = SpawnTanker:GetFirstAliveGroup()
    
     -- New Spawn in case Crash
     SpawnGroup:HandleEvent( EVENTS.Crash )
     function SpawnGroup:OnEventCrash(EventData)
       local limit = 3 - Index
SpawnTanker:InitLimit(1,limit):Spawn()
     end

     -- Re-Spawn same group in case EngineShutdown (as refueling)
     SpawnGroup:HandleEvent( EVENTS.EngineShutdown)
     function SpawnGroup:OnEngineShutdown(EventData)
SpawnTanker:InitLimit(1,0):Spawn()
     end
   end
 )

-- Spawn first Tanker
SpawnTanker:InitLimit(1,0):Spawn()

 

Hope to know if there is easier way.

 

my 2nd inquiry is about how I can delay spawn? once I call :Spawn() I want it to be delayed like 60 seconds


Edited by Rabso

i7-6700K | MSI Z170A Gaming M7 | Dominator 32GB 3000MHz | MSI GTX 1070 GAMING Z | 2TB SSD & 1TB HDD | Acer H277HU 27" WQHD | Audeze Mobius | TM Warthog | MFG Crosswind | TrackIR 5 | Windows 10 Pro

Link to comment
Share on other sites

Hi!

 

possible to use the framework with Persian Gulf map for a A2A Dispatcher?

 

 

 

e.g. :

 

I need to place suqadrons on Airbases and don't think it works at the moment a syntax such as AIRBASE.Persian_Gulf."name of the airfield"

 

 

 

For the Persian Gulf map just use the airfield name.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

this is my 3rd day on learning MOOSE and I am really impressed of how much this platform made our life easier. Thanks to the author and all contributors for this achievement.

 

I have two inquiry; first I have a tanker that will spawn at start then whenever it lands (no fuel) it will re-spawn again (it simulate refueling and fly again).

In case it was shot down, new group will spawn.

 

Now talking about limits, I want total limit of 3 tankers, however I want :InitRepeatOnEngineShutDown() not to be counted in this limit. How could I achieve this?

 

 

 

SpawnTanker = SPAWN:New('Tanker')
:InitLimit(1,3) -- 1 alive, limit 3
:InitCleanup(30) -- removes tanker after being idle 30 seconds on the ground
:SpawnScheduled(60,0) -- will attempt to spawn a new tanker every 60 seconds until InitLimit is reached


Edited by RAF_Raven
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...