Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

Hi I'm trying to learn how to use the MOOSE framework by creating a simple mission.

I try to use the UNIT_ZONE function.
I basicay copied reference mission ZON-300

So in the scrips I made a unit
RedVehicle1 = SPAWN

:New( "BMP3 1"):InitLimit( 1, 0)

This works fine and the unit spawns and drives the planned route.

I then use the following line :

BMP3Zone = ZONE_UNIT:New( "BMP3 Zone", Redvehicle1, 5 ) (Basicaly coppied straight from ZON-300)

 

The DCS.log now gives the following error :

Mission script error (Path) Attempt to call method GetVec2() (a nil value)

Stack traceback :

In function GetVec2()

string (path) in function new

string (path) in main chunk.

 

Source code shows part of the ZONE_UNIT function is the GetVec2() function (presumably getting the coordinate of the unit to create the zone)

Thinking this was because of late activation

I removed late activation , no change,
I wraped the function in a : RedVehicle1:IsAlive() check but also no change

 

Further reading leads me to beleave this is a value that I do not need to declare before hand.

I cant see what I did wrong here as I coppied the line almost literaly from the demo mission.

 

Is there any thing I'm missing here or am I using an outdated template??

Link to comment
Share on other sites

If you’re starting out or looking for information, please read these first and it might be worth doing some basic Lua tutorials.

No use getting frustrated by jumping into the pool without being able to swim. There are some docs that can help you out (very easily over looked)


Moose users manual - https://github.com/FlightControl-Master/MOOSE_GUIDES/releases/download/v0.1-rc1/Moose_User_Guide.pdf <<< read first chapter at least
Basic Moose debugging guide PDF - https://ufile.io/nzduno3q>
MOOSE demo missions, great source https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop
MOOSE documentation, has info on functions and how to use them - https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/
Lua tutorial <https://www.tutorialspoint.com/lua/index.htm>

 

No more pre-orders

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

On 3/4/2022 at 1:10 PM, Erikson said:

Hi I'm trying to learn how to use the MOOSE framework by creating a simple mission.

I try to use the UNIT_ZONE function.
I basicay copied reference mission ZON-300

So in the scrips I made a unit
RedVehicle1 = SPAWN

:New( "BMP3 1"):InitLimit( 1, 0)

This works fine and the unit spawns and drives the planned route.

I then use the following line :

BMP3Zone = ZONE_UNIT:New( "BMP3 Zone", Redvehicle1, 5 ) (Basicaly coppied straight from ZON-300)

 

The DCS.log now gives the following error :

Mission script error (Path) Attempt to call method GetVec2() (a nil value)

Stack traceback :

In function GetVec2()

string (path) in function new

string (path) in main chunk.

 

Source code shows part of the ZONE_UNIT function is the GetVec2() function (presumably getting the coordinate of the unit to create the zone)

Thinking this was because of late activation

I removed late activation , no change,
I wraped the function in a : RedVehicle1:IsAlive() check but also no change

 

Further reading leads me to beleave this is a value that I do not need to declare before hand.

I cant see what I did wrong here as I coppied the line almost literaly from the demo mission.

 

Is there any thing I'm missing here or am I using an outdated template??

 

The SPAWN object and the GROUP object are different things, but you are treating them the same by using a SPAWN obj when you should use the GROUP object.

The right technique for this IMO is to use an OnSpawnGroup() callback function where you can do things to the dynamically named group that just spawned.

 

Banner EDForum2020.jpg

Have fun. Don't suck. Kill bad guys. 👍

https://discord.gg/blacksharkden/

Link to comment
Share on other sites

  • 2 weeks later...

Hello.
I don't know if it is possible but I am looking to include a racetrack circuit for tankers that I take off from airbases.
I tried with the RECOVERYTANKER:_Pattern() command but I can't build a table of pattern waypoints.
Do you have any idea how to solve my question?
Thanks in advance.

Link to comment
Share on other sites

Hello I encountered strange bug in my dynamic campaign build with Moose. I don't know when it started to happen but now Moose do not register DEAD event correctly for some units. For example it works for T-55 but not for T-72. I can see there is some cooking of simulation on T-72 as it takes time to get dead with cooking of fire anim.

DCS events are fine and contains initiator data. Moose ones are NIL in case of T-72. I discovered it is more units that behaves like that and Moose doesn't send DEAD event correctly. I just noticed in my campaign that units I destroyed are alive in next phase and tracked issue to Moose event reporting. Both release and dev Moose versions behave same.

See pictures, video and test mission attached. Any advices how to solve this please?

test.miz

 

T55.png

T72.png

Link to comment
Share on other sites

On 3/21/2022 at 6:49 AM, ataribaby said:

Hello I encountered strange bug in my dynamic campaign build with Moose. I don't know when it started to happen but now Moose do not register DEAD event correctly for some units. For example it works for T-55 but not for T-72. I can see there is some cooking of simulation on T-72 as it takes time to get dead with cooking of fire anim.

DCS events are fine and contains initiator data. Moose ones are NIL in case of T-72. I discovered it is more units that behaves like that and Moose doesn't send DEAD event correctly. I just noticed in my campaign that units I destroyed are alive in next phase and tracked issue to Moose event reporting. Both release and dev Moose versions behave same.

See pictures, video and test mission attached. Any advices how to solve this please?

test.miz 1.46 MB · 0 downloads

 

 

This is a known DCS bug. Hopefully they do something about it soonish but I wouldn't hold your breath.

Link to comment
Share on other sites

Hi All,

What is the best method to delay a new CAP from spawning after the previous CAP has been destroyed?

We have a training mission with 2 CAPs, and would like a 20 min delay after they have been destroyed, to allow for strike aircraft to proceed to the target without further hindrance, as this provides great training.

Currently if we use CAP Time Interval, and set it to ~20 min, it doesn't really work, as the previous check may have happened 15min before the CAP flight was destroyed, therefore spawning a replacement 5 min later.

Is there a better solution? Even if we spawn the aircraft immediately, but then hold them on the ground for a set period of time, that would work. Is this possible?


Edited by norman99
Link to comment
Share on other sites

Lots of methods to do this in Moose. One way is to use event.dead method to detect when the CAP meets its demise, which initiates a timer to trigger a spawn function (NewBandit) after an expired time (1200 seconds).

timer.scheduleFunction( NewBandit, {}, timer.getTime() + 1200 )

or adapt a SpawnScheduled like this

Red_CAP = SPAWN:New( "Red_CAP" )
                  :InitLimit( 2, 1 )   -- Spawns two 2-ship groups, only 1 group alive at a time
                  :SpawnScheduled( 1200, 0 )  -- Spawns subsequent group(s) after 1200 seconds

 

Link to comment
Share on other sites

Bit confused with the setup/workflow for Moose. Following the FlightControl Moose setup videos...

1) somewhere on C drive we create folders for moose, moose (demo) missions and our moose missions, e.g.:
c:\xxx\moose
c:\xxx\moose missions
c:\xxx\my moose missions

2) create in an eclipse workspace:
LUA project based on project in c:\xxx\moose
LUA project based on project for c:\xxx\moose missions, and 
LUA project (new) for our moose missions called "My_Missions" (this appears to be in no way linked to the 3rd folder in step1 ???) and then a new folder under My_Missions.
In the new folder we create a lua file with code which is referenced in the DCS mission editor and we save the miz file back to same location in the workspace.

3) create following junctions for step1 folders to the "user\saved games" folder:
c:\xxx\moose missions -> user\saved games\moose missions
c:\xxx\my moose missions -> user\saved games\my moose missions

Moving onto the "Moose for Dummies" videos, everything (both the miz file and lua script) appear to be getting saved in / run from the "c:\xxx\my moose missions" location and NOT in the "My_Missions" eclipse workspace folder created in step2.
So I am confused how we're coding and can get benefit of intellisense if these files never appear in the workspace (in other words, that folder and workspace location arent linked) ?


Edited by Pvt Hudson
Link to comment
Share on other sites

Unfortunately many of the older Moose YouTube videos, including setup procedures, are obsolete; and the current developers have no control over them. Recommend you visit the Moose Discord where plenty of current guidance and help reside.

Link to comment
Share on other sites

Hi I  just started adding in custom goals that are used by  the moose's scoring  system. When the code runs it both adds the points and then adds a PENALTY of the same amount of points it just gave the player.  Since there is only one number that you input when you call the scoring method, and since I make it positive and never negative , I have no IDEA what is wrong and none on how to fix it. When I call this method  it is outputting both POSITIVE & NEGATIVE numbers  I assume which end up going into the  Score/Penalty Values that get displayed at game time. 

Scoring:AddGoalScorePlayer("Playername","FARP TROOPS","FARP TROOPS: +250 ",250)
Link to comment
Share on other sites

On 1/31/2020 at 5:12 AM, xplod said:

Escorting an AI plane

 

Hi. I want to know if it's possible to script escorting of AI planes.

 

 

Scenario:

There's 1 late-activated AWACS named "AWACS BLUE".

If I use SPAWN:New("AWACS BLUE") I get instances called "AWACS BLUE #0001"

 

 

How can I add an F16 to protect the freshly spawned AWACS? Does the ESCORT Class help with this, or is it possible to simply spawn a Fighter plane and assign the escort task?

I understand that this was AGES ago, but did you ever figure this out. I'm attempting this very thing right now and not getting anywhere.

 

Thanks .

 

MM

Link to comment
Share on other sites

1 hour ago, Delta99 said:

Yes, this is very doable with Moose.

I gather that it's doable. I am trying to figure out how. All I can find is guides on how to setup client escorts (which I've already done) it doesn't seem to be listed how to tell one existing (scripted spawned unit) to take off, escort an existing unit (in this case an AWACS) then have them land if they run out of fuel and another one spawn if either of the two in the ai escort group gets shot down.

Link to comment
Share on other sites

vor 9 Stunden schrieb Badass1982:

I gather that it's doable. I am trying to figure out how. All I can find is guides on how to setup client escorts (which I've already done) it doesn't seem to be listed how to tell one existing (scripted spawned unit) to take off, escort an existing unit (in this case an AWACS) then have them land if they run out of fuel and another one spawn if either of the two in the ai escort group gets shot down.

At least it is doable with the Auftrag Class. This class is in the development branch of Moose. Best is to check the Moose discord. There are more information.

Link to comment
Share on other sites

15 hours ago, buur said:

At least it is doable with the Auftrag Class. This class is in the development branch of Moose. Best is to check the Moose discord. There are more information.

I've looked into that , but the AWACS I'm trying to spawn is already spawned in another script In the mission (not created by me) , all I'm looking for this tiny script to do is to take off some fighters, locate the already spawned AWACS and continue to escort it until it runs out of fuel or they lose a fight.

 

Most of the autfrag examples I see , you HAVE to create BOTH the escorters AND the Escortees in the same script.

 

There has to be a way to write a small script (I don't care which class it uses) to accomplish this.

 

FWIW I have asked on tbe discord but I'm not a very experienced scripter and I generally just get met with "use this class" , that's the issue.


Edited by Badass1982
Link to comment
Share on other sites

Recently I've struggled getting a RecoveryTanker to use AirBoss as the controlling authority when returning to the carrier. It always just seems to use the DCS SuperCarrier ATC instead.

I've read elsewhere that if using the Dev branch of MOOSE, AirBoss no longer controls all AI groups, but only elements defined as a FlightGroup. Is this my problem? If it is, how do I use the RecoveryTanker Class, and define it as FlightGroup so it's controllable via AirBoss?

Link to comment
Share on other sites

  • 4 weeks later...

How to use OnSpawnGroup?I wanna check the group units dead or not.if dead spawn another zone grond units

This is my code

GroundUnits = SPAWN:New("Ground-1")
  :InitAIOn()
  :OnSpawnGroup(
   function(SpawnGroup)
     SpawnGroup:HandleEvent(EVENTS.Dead)
     function SpawnGroup:OnEventDead(EventData)
        GroundUnits = SPAWN:New("Ground-1")
        :SpawnFromCoordinate(ZONE:FindByName("zone2"):GetCoordinate())
     end
   end
   )
  :SpawnFromCoordinate(ZONE:FindByName("zone1"):GetCoordinate())

 


Edited by zhouyut001
  • GamingPC: Ryzen 5950X  + 64G RAM + Nvidia 4090 + 1T Dedicated SSD For DCS 
  • HOTAS: WingWin F15EX Throttle + VKB Gunfighter Mk.III Joystick + SN2 Rudder + TrackIR Pro
  • HomeServer: Dell R7515 (EPYC 7402 + 1 T RAM + 48T SSD Raid10 + Nvidia A40
  • Network: Google Fiber 2G

 

Link to comment
Share on other sites

  • 1 month later...

Trying to find a MOOSE class or other scripting tool that would allow me to task the enemy AI with random ground attacks on my ground forces, i.e. FOB, airfield, AA positions, artillery

Would like to use MOOSE since it's what I've scripted the entire scenario with, thanks.

 

 

And I will execute vengeance in anger and fury upon the heathen, such as they have not heard.

                                                                                                                 Micah 5:15

Link to comment
Share on other sites

  • 2 weeks later...
On 7/1/2022 at 11:45 PM, rwbishUP said:

Trying to find a MOOSE class or other scripting tool that would allow me to task the enemy AI with random ground attacks on my ground forces, i.e. FOB, airfield, AA positions, artillery

Would like to use MOOSE since it's what I've scripted the entire scenario with, thanks.

 

Chief of staff in MOOSE can do exactly what you are looking for and then some , the possibilities are really endless, the problem I'm having is I'm garbage at Lua lol.

 

Need to find someone to help me code , but yeah check it out see if it's what you are looking for I intend to use it to control ALL my AI from naval to ground to air, red and blue etc... Just as soon as I'm competent in Lua/moose.

 

https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Ops.Chief.html

  • Like 1
Link to comment
Share on other sites

Hey thanks for the heads up, @Badass1982. Headed to check it out, and don't feel bad, I suck at scripting too. If it weren't for Eclipse LDT intellisense, I wouldn't have a prayer..lol.

 

And I will execute vengeance in anger and fury upon the heathen, such as they have not heard.

                                                                                                                 Micah 5:15

Link to comment
Share on other sites

Hi,

I was wondering if there is a script like RAT (random air traffic) but for shipping? I’d like to add randomized merchant ship traffic as background for some of my missions.

thanks a lot and best regards.

 

Eduardo

 

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

4 hours ago, Rudel_chw said:

Hi,

I was wondering if there is a script like RAT (random air traffic) but for shipping? I’d like to add randomized merchant ship traffic as background for some of my missions.

thanks a lot and best regards.

 

Eduardo

I asked about the same thing. RAT can’t do it but you might be best using the spawn class and using random zones/routes

  • Like 1
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...