Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

MOOSE Release 2.3.0

 

Assets

 

 

  • Moose.lua (with comments, larger file) ... For mission designers, who are developing missions and want to check upon errors appearing in the dcs.log or have a detailed code reference etc.
  • Moose_.lua (without comments, smaller file) ... For runtime environments, to facilitate quicker downloads of mission files and performance.

You can download the files in the Downloads section below.

 

 

To use, include the Moose.lua in your .miz file using a DO SCRIPT Trigger. Mission Designers need to read here for a detailed usage description. Consult the MOOSE documentation for further details on the framework.

 

 

 

1. RANGE Practice

 

68747470733a2f2f666c69676874636f6e74726f6c2d6d61737465722e6769746875622e696f2f4d4f4f53455f444f43532f50726573656e746174696f6e732f52414e47452f52414e47455f4d61696e2e706e67

 

 

The RANGE class enables easy set up of bombing and strafing ranges within DCS World.

 

 

Implementation is based on the Simple Range Script by Ciribob, which itself was motivated by a script by SNAFU see here.

476th - Air Weapons Range Objects mod is highly recommended for this class.

 

Features

 

  • Impact points of bombs, rockets and missils are recorded and distance to closest range target is measured and reported to the player.
  • Number of hits on strafing passes are counted and reported. Also the percentage of hits w.r.t fired shots is evaluated.
  • Results of all bombing and strafing runs are stored and top 10 results can be displayed.
  • Range targets can be marked by smoke.
  • Range can be illuminated by illumination bombs for night practices.
  • Bomb, rocket and missile impact points can be marked by smoke.
  • Direct hits on targets can trigger flares.
  • Smoke and flare colors can be adjusted for each player via radio menu.
  • Range information and weather report at the range can be reported via radio menu.

 

 

2. Zone Capturing

 

68747470733a2f2f666c69676874636f6e74726f6c2d6d61737465722e6769746875622e696f2f4d4f4f53455f444f43532f50726573656e746174696f6e732f5a4f4e455f434150545552455f434f414c4954494f4e2f446961312e4a5047

 

 

Models the process to capture a Zone for a Coalition, which is guarded by another Coalition.

 

 

This is a powerful concept that allows to create very dynamic missions based on the different state transitions of various zones.

Models the possible state transitions between Guarded, Attacked, Empty and Captured states. A zone has an owning coalition, that means that at a specific point in time, a zone can be owned by the red or blue coalition.

 

 

The Zone can be in the state Guarded by the owning coalition, which is the coalition that initially occupies the zone with units of its coalition. Once units of an other coalition are entering the Zone, the state will change to Attacked. As long as these units remain in the zone, the state keeps set to Attacked. When all units are destroyed in the Zone, the state will change to Empty, which expresses that the Zone is empty, and can be captured. When units of the other coalition are in the Zone, and no other units of the owning coalition is in the Zone, the Zone is captured, and its state will change to Captured.

 

 

 

3. ATC Operations

 

68747470733a2f2f666c69676874636f6e74726f6c2d6d61737465722e6769746875622e696f2f4d4f4f53455f444f43532f50726573656e746174696f6e732f4154435f47524f554e442f446961312e4a5047

 

 

The ATC_GROUND_CAUCASUS class monitors the speed of the airplanes at the airbase during taxi.

The pilots may not drive faster than the maximum speed for the airbase, or they will be despawned.

 

 

4. RAT

 

68747470733a2f2f666c69676874636f6e74726f6c2d6d61737465722e6769746875622e696f2f4d4f4f53455f444f43532f50726573656e746174696f6e732f5241542f5241542e706e67

 

Lots of improvements on the RAT system.

 

 

The aim of the RAT class is to fill the empty DCS world with randomized air traffic and bring more life to your airports.

In particular, it is designed to spawn AI air units at random airports. These units will be assigned a random flight path to another random airport on the map.

 

 

Even the mission designer will not know where aircraft will be spawned and which route they follow.

 

Features

 

  • Very simple interface. Just one unit and two lines of Lua code needed to fill your map.
  • High degree of randomization. Aircraft will spawn at random airports, have random routes and random destinations.
  • Specific departure and/or destination airports can be chosen.
  • Departure and destination airports can be restricted by coalition.
  • Planes and helicopters supported. Helicopters can also be send to FARPs and ships.
  • Units can also be spawned in air within pre-defined zones of the map.
  • Aircraft will be removed when they arrive at their destination (or get stuck on the ground).
  • When a unit is removed a new unit with a different flight plan is respawned.
  • Aircraft can report their status during the route.
  • All of the above can be customized by the user if necessary.
  • All current (Caucasus, Nevada, Normandy) and future maps are supported.

The RAT class creates an entry in the F10 radio menu which allows to

 

  • Create new groups on-the-fly, i.e. at run time within the mission,
  • Destroy specific groups (e.g. if they get stuck or damaged and block a runway),
  • Request the status of all RAT aircraft or individual groups,
  • Place markers at waypoints on the F10 map for each group.

Note that by its very nature, this class is suited best for civil or transport aircraft. However, it also works perfectly fine for military aircraft of any kind.

 

 

 

5. User Sounds

 

A simple class for the Management of DCS User Sounds.

 

 

 

 

6. User Flags

 

A simple class for the Management of DCS User Flags, which are set within the Mission Editor.

 

 

 

7. Upcoming in Release 2.4.0.alpha

 

 

NOTE: There is also cargo capability in release 2.3.

But consider this cargo functionality WIP.

The upcoming release 2.4 is focused solely on CARGO, which includes:

 

  1. Cargo Management (Cargo of different types)
  2. Cargo Transport Tasking
  3. Cargo CSAR Tasking
  4. AI Armoured Personnel Carrier moving Cargo
  5. AI Helicopter moving Cargo
  6. AI Planes moving Cargo
  7. AI Ships moving Cargo
  8. Slingloading
  9. Cargo objects loading/unloading
  10. Cargo Infantry boarding and unboarding one by one
  11. ...

 

A lot of that can already be tested in the develop branch of the MOOSE Framework... I'll open a 2.4.0.alpha release for this purpose, so you know what is coming.

 

You can download the latest new functions of Moose.lua in the release 2.4.0.alpha from the develop branch of the MOOSE_INCLUDE repository.

 

And a special thanks to FunkyFranky, who is making all these wonderful classes and helping to extend the framework... Other community members have been posting me other classes. We really appreciate the efforts and your contributions.

If you are planning to create a new class to be added in the framework, we advise we discuss the approach, design, purpose, just as Frank and myself are jointly doing.

 

Thanks!

 

FC and FunkyFranky and all MOOSE contributors


Edited by FlightControl
  • Like 3
  • Thanks 1

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Thank you Sven, looks excellent!

I'll have a look around and give back my review, but seems very useful by the documented functions.

 

BTW, nice stathandler.lua file, seems awefully similar to my estathandler.lua file that I published a while back on how to create statistics.


Edited by xcom
Link to comment
Share on other sites

Thank you Sven, looks excellent!

I'll have a look around and give back my review, but seems very useful by the documented functions.

 

BTW, nice stathandler.lua file, seems awefully similar to my estathandler.lua file that I published a while back on how to create statistics.

 

 

 

Hey Xcom. Yes. The stathandler is yours. Forgot to mention that. I will revise the text of the intro.

Due to your advise and your posts on event catching and logging, I started to understand event handing much better.

Now that being said, if you have a look to the base class in the class hierarchy, you'll see how I catch events for the classes. Pay careful attention how I passed the 'self' variable to the BASE class event handler... It worked. So now the event handler works polymorphic for all derived classes from base.

Much more stuff to discuss, eg. Include script files, mist embedding (with grimes), your start files handler, score system, database class.

Consider this an alpha version. It is the idea of it that could be considered. Through objects, build a script framework. Each object defines it's behaviour, control and takes off the mission.


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hey Sven,

 

Thanks, thought I recognized it :)

 

I'm trying to use the MOOSE framework, kinda hard to get into the structure so I'm just copying your parts from the Gori Valley script.

 

I'm attaching the miz file and the lua I made that is relevant to your framework.

Hopefully I did things correctly, unfortunately for some reason there are no missions shown when I take the relevant planes.

 

Thanks for any help!

Operation JaggerNautV3.4_no external.miz

JagerNaut.lua

Link to comment
Share on other sites

In the meanwhile, can you send the dcs.log and the missionscripting.lua from the scripts directory to my private mailbox?

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I think I know the problem. Have you started the MISSIONSCHEDULER? Check Gori valley script, there are 3 lines with mission scheduler.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I did add the following to the end of the JagerNaut.lua file -

-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsFlash( 120 )

 

Were these the lines you talked about?

Link to comment
Share on other sites

Hey Sven,

 

 

 

 

 

Thanks, thought I recognized it :)

 

 

 

 

 

I'm trying to use the MOOSE framework, kinda hard to get into the structure so I'm just copying your parts from the Gori Valley script.

 

 

 

 

 

I'm attaching the miz file and the lua I made that is relevant to your framework.

 

 

Hopefully I did things correctly, unfortunately for some reason there are no missions shown when I take the relevant planes.

 

 

 

 

 

Thanks for any help!

 

 

 

Xcom, I was asleep when you posted yr message. Had just a look at your code. You did start the missionscheduler in your code

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I did add the following to the end of the JagerNaut.lua file -

-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsFlash( 120 )

Were these the lines you talked about?

 

Found it, and fixing it right now.

You are using mist also in your mission. And i was using the same structure in the framework. They conflict.

 

So, am just renaming the mist structure in the framework, and then i'll need to republish a new version of moose. This should solve the problem.

 

Give it a few hours more time for a fix.

By having users the framework will get issues like these resolved, things i did not think off when building it :-) So these can get fixed and it will get better... mist was built like this also eh :-)

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

xcom, i've fixed the issue.

 

Because i copied a selection of very useful mist functions into another mist file, your utilization of mist was conflicting with the "shadowed" mist file...

Fixed this issue internally in the framework.

 

To re-test your mission, you'll need to reinstall the framework on your PC. I've updated it at the first post. So please download MOOSE.ZIP and follow the installation procedures here: http://users.telenet.be/FlightControl/topics/manual.md.html

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hi all,

 

svenvandevelde, pretty awesome tools !!!

 

If it is possible, I would like some help.

 

I've created a small mod which enable huge smokes and fire (Forest Fire > Fire Fighter with Huey or Mi-8)

http://forums.eagle.ru/showthread.php?t=138241

 

As you might understand it burns only when the "object" is destroyed.

 

The idea is to disable the object via trigger (sling load etc)

 

Unfortunetaly it is not possible to disable a unit when it's destroyed with the stock DCS ME.

 

As I am not a talented lua coder, I guess that your script could bring a solution to my issue.

 

May be with CLEANUP function ?

 

If you could provide a tip or little help, this will be much appreciate ;)

 

Thanks !

Link to comment
Share on other sites

this looks great Sven. Does this mean that the infantry drops MiST issue would work properly if MOOSE is used instead?

 

 

 

Nope. The "issue" is a problem with an api of dcs world. The api coalition:addGroup makes the clients in 1.2.14.36041 crash. My missions are also impacted by this bug: Gori valley and anapa airbase... Gori is currently live on my server. If you want to try, you have to downgrade your dcs installation to version 35734 and you can run it. As a consequence the ctts scripts still also work which are used in other people missions for troop drops etc.. Execute dcs_updater update 1.2.14.35734 in the bin directory of your dcs install.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Hi all,

 

svenvandevelde, pretty awesome tools !!!

 

If it is possible, I would like some help.

 

I've created a small mod which enable huge smokes and fire (Forest Fire > Fire Fighter with Huey or Mi-8)

http://forums.eagle.ru/showthread.php?t=138241

 

As you might understand it burns only when the "object" is destroyed.

 

The idea is to disable the object via trigger (sling load etc)

 

Unfortunetaly it is not possible to disable a unit when it's destroyed with the stock DCS ME.

 

As I am not a talented lua coder, I guess that your script could bring a solution to my issue.

 

May be with CLEANUP function ?

 

If you could provide a tip or little help, this will be much appreciate ;)

 

Thanks !

 

 

 

Indeed. The cleanup function could be used for that. But there are two types of objects in dcs: Units and Statics. Cleanup will currently only work for units, but making it work for statics should not be difficult to implement. Take a good look at the example mission Gori valley on the first thread. Install moose on your dcs install.

 

Include the cleanup script using Include.File("cleanup")

 

Then, you declare a cleanup following the example code in the documentation. Give it a try, it may work

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Question to you all and ed dev team. As you can see, the framework moose consists put of several lua source files. The mission editor is pretty bad at importing multiple lua sources into a mission file. It is very labour intensive and every time you update a lua file you need to reimport the file in the mission. That is why I am currently using the installation trick. The framework is installed in the scripts directory and with a hook in missionscripting.lua I managed to make dcs multiplayer to load the framework before missin startup. This is all nice as long as players have the framework installed. Is there any technique that would allow to "publish" the framework into a miz file and post it embedded within the mission without having to manually import every lua script file? Believe me, I've been there... Help or ideas would be appreciated... Sv.

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Question to you all and ed dev team. As you can see, the framework moose consists put of several lua source files. The mission editor is pretty bad at importing multiple lua sources into a mission file. It is very labour intensive and every time you update a lua file you need to reimport the file in the mission. That is why I am currently using the installation trick. The framework is installed in the scripts directory and with a hook in missionscripting.lua I managed to make dcs multiplayer to load the framework before missin startup. This is all nice as long as players have the framework installed. Is there any technique that would allow to "publish" the framework into a miz file and post it embedded within the mission without having to manually import every lua script file? Believe me, I've been there... Help or ideas would be appreciated... Sv.

When you use a DO SCRIPT FILE somewhere, the ME copies the .LUA file into the MIZ file. When starting such a mission, it is first unpacked in the %TEMP% folder and then DCS uses these temporary files. I think, this temporary folder is added to the scripts path that DCS uses.

 

I have not tested this, but this should then work as well:

- DO SCRIPT FILE "A.LUA"

- a.lua requires() an file b.lua

- b.lua is NOT included in the .MIZ automatically as nobody DO SCRIPT FILEed it anywhere

- open .MIZ file, add b.lua manually

- ???

- Profit ...?

 

Maybe already known by you, but just to make sure: afaik the ME checks only the file name of an DO SCRIPT FILE statement. If that lua alreads was importet into the .MIZ file by DCS, it will not import it again. This is a pita if you change your (external) version of the file and want the updated version to be used by DCS. Removing the DO SCRIPT FILE and re-applying it should work, but you cal also always update the .MIZ manually with your newer version.

 

(It would be cool if ED would add some "compile mission" function to the ME. This would then import all external ressources (lua scripts, mission briefing pics, etc.) into the .MIZ file, regardless if thy were already imported earlier.)

Link to comment
Share on other sites

H'lo,

I am trying to use MOOSE for the cleanup function but seem to be having some problems. Using Gori Valley mission as an example, I took the .lua file and stripped it down to just the cleanup portion:

 

Include.File( "Mission" )
Include.File( "Client" )
Include.File( "DeployTask" )
Include.File( "PickupTask" )
Include.File( "SlingLoadHookTask" )
Include.File( "SlingLoadUnHookTask" )
Include.File( "DestroyGroupsTask" )
Include.File( "DestroyRadarsTask" )
Include.File( "DestroyUnitTypesTask" )
Include.File( "GoHomeTask" )
Include.File( "Spawn" )
Include.File( "Movement" )
Include.File( "Sead" )
Include.File( "CleanUp" )



--- Keep some airports clean
CLEANUP_Airports = CLEANUP:New( { 'Clean Sochi' }, 60 )


-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsFlash( 120 )

env.info( "VA Cleanup.lua loaded" )

 

 

 

MOOSE is installed, but had to modify the MissionScripting.lua because I am also using Witchcraft and SLMOD. Below is how I added it:

 

dofile('Scripts/ScriptingSystem.lua')

--MOOSE
Include = {}

Include.LoadPath = 'Scripts/MOOSE'
Include.Files = {}

Include.File = function( IncludeFile )
if not Include.Files[ IncludeFile ] then
	Include.Files[includeFile] = IncludeFile
	dofile( Include.LoadPath .. "/" .. IncludeFile .. ".lua" )
	env.info( "Include:" .. IncludeFile .. " loaded." )
end
end

Include.File( "Trace" )
Include.File( "Routines" )
Include.File( "Database" )
Include.File( "StatHandler" )

--Witchcraft
witchcraft = {}
witchcraft.host = "localhost"
witchcraft.port = 3001
dofile(lfs.writedir()..[[scripts\witchcraft.lua]])


local function sanitizeModule(name)
_G[name] = nil
package.loaded[name] = nil
end
-------------------------------------------------------------------------------------------------------
-- Slmod begins here.

 

 

I edited the mission to Do Script File on the cleanup.lua and also added the trigger area in the mission.

 

It does not appear to be cleaning the wrecks (client spawned aircraft, crashed on purpose) off the trigger areas in either the Gori Valley mission or my edited mission. I did notice that I am getting these errors repeatedly in the DCS.log file

 

 

00080.980 ERROR   DCS: Mission script error: : error in error handling
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Trace.lua"]:99: attempt to index global 'debug' (a nil value)
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: attempt to index global 'debug' (a nil value)
00081.036 WARNING LOG: 195 duplicate message(s) skipped.
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: C stack overflow
00081.036 INFO    SCRIPTING: Error in scheduled function:[string "Scripts/MOOSE/Routines.lua"]:476: attempt to index global 'debug' (a nil value)
00081.782 WARNING LOG: 22 duplicate message(s) skipped.

 

 

Have been looking forward to a cleanup of wreckage script for a long while and look forward to getting this working.

 

Thank you for any help you can provide.

Shahdoh


Edited by Shahdoh
Link to comment
Share on other sites

  • Recently Browsing   0 members

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