Jump to content

[MOOSE] RAT - Random Air Traffic


Recommended Posts

OK...maybe I've been looking at my screen too long...absolutely confused.

 

How do I write a script that allows me to have an aircraft depart an airbase, travel to a CAP Station, patrol, then return to base?

 

I've been reading and reading...and have myself confused.  I found the following but not sure how it applies.  Can someone please help?

 

Thanks - Dave

---
-- Name: CAP-001 - Combat Air Patrol
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
-- The Su-27 airplane will patrol in PatrolZone.
-- It will not engage any enemy automatically.
-- 
-- # Test cases:
-- 
-- 1. Observe the Su-27 patrolling.
-- 

local CapPlane = GROUP:FindByName( "Plane" )

local PatrolZone = ZONE:New( "Patrol Zone" )

AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )

AICapZone:SetControllable( CapPlane )

AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
Link to comment
Share on other sites

  • 3 weeks later...

Hallo everyone.  

Please help me, I don't understand what I'm doing wrong?


Problem statement-
Basic RAT script does not spawn any aircraft.

 

Steps-
Here is what I did to spawn Cessna's from the Civilian Aircraft Mod.

I started from scratch with a clean mission.


Here is the basic script for the Cessna's (file name is RAT_cessna.lua)
local cessna=RAT:New("RAT_cess")
cessna:Spawn(25)

 

Open DCS Mission Editor > Create New Mission
I place airplane group object anywhere on the map.


On the Right Side panel-
Name of group is RAT_cess
Select aircraft Type Cessna P210N
Tick box Late Activation

 

On the left of the mission editor screen I click on Set Rules for Trigger, to open the Triggers page.
Under Triggers, I click on New.
Type is set to 1 Once.
I give it a name, Moose Start.
Event is set to ON MISSION START

 

Under Actions, I click New.
Action is set to DO SCRIPT FILE.
File that is chosen is MOOSE.2.5.3.lua

 

Under Triggers, I click on New again.
I give it a name, RAT Start.
Event is set to ON MISSION START

 

Under Actions, I click New.
Action is set to DO SCRIPT FILE.
File that is chosen is RAT_cessna.lua

I Save the mission file, and launch.

 

Outcome-

I spawn into the map like a floating camera.  I open the map with F10 and wait a while, but nothing spawns.

 

I have read multiple pages in this thread and tried different things, it feels like I'm doing it over and over and it is not working.

Ultimately I want to spawn in F22's and C130's when I get it going.

Any help is appreciated.

Maintain thy airspeed lest the ground rise up and smite thee!

YiizHx5.gif

Link to comment
Share on other sites

1 hour ago, ZoRPA said:

Hallo everyone.  

Please help me, I don't understand what I'm doing wrong?


...

Any help is appreciated.


Hello,

 

attach the mission file and I will take a look at it

 

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

1 hour ago, ZoRPA said:

Thank you for taking a look.

 

Hello,

 

The problem is that you are using the "ON MISSION START" event ... for some reason it does not work well. I replaced it with "NO EVENT" and set TIME MORE conditions to load Moose at 2 seconds into the mission, and then load your LUA when 5 seconds into the mission, like this:

 

4WfUe4i.jpg

 

That's enough to get the mission working, however all your 25 cessnas will have the same default livery. I added these lines to the script in order to have random liveries:

 

local cessna_skins={"D-EKVW", "HellenicAF", "IRAN_Airlines_Cessna", "Muster", "N9572H", "SEagle blue", "SEagle red", "USAF-Academy", "V5-BUG", "VH-JGA"}
local cessna=RAT:New("RAT_cess")
cessna:Livery(cessna_skins)
cessna:Spawn(25)

 

The livery name is actually the folder name of the livery ... check your install because maybe you don't have the same liveries I do:

 

DXKLRPX.jpg

 

Here is the modified mission for you to try.

Best regards,

 

Eduardo

 

RAT_Cessna.miz


Edited by Rudel_chw
  • Thanks 1

 

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

Hallo again everyone.

The Cessna script works well so far with a few variations.

 

I want to ask things about other aircraft types.

 

Working with this basic script as an example:

local cessna=RAT:New("RAT_cess")
cessna:Spawn(25)

 

Does Moose only work with aircraft added under your Saved Games\DCS\Mods?

If I change cessna to F-15 for instance, will that work?

How does Moose know I want to spawn F-15's?  I mean F-15 falls under Flaming Cliffs.

My guess is there will have to be a standard name to define each aircraft, is there such a list?

Or can I work off of the aircraft folder name found in DCS?

 

 

Oh, and to everyone out there.

If you make use of the Civil Aircraft Mod, there is a .lua file with a lot of examples in, where you can just copy the text out of.

Found under -

C:\Users\username\Saved Games\DCS\Mods\Aircraft\Civil Aircraft Mod\Missions\QuickStart\RAT Script_Caucasus.lua

 


Edited by ZoRPA
  • Like 1

Maintain thy airspeed lest the ground rise up and smite thee!

YiizHx5.gif

Link to comment
Share on other sites

27 minutes ago, ZoRPA said:

Does Moose only work with aircraft added under your Saved Games\DCS\Mods?

If I change cessna to F-15 for instance, will that work?

 

Yes, Moose RAT works with all aircrafts that you have in DCS both playable, AI, official or user mods.

 

27 minutes ago, ZoRPA said:

How does Moose know I want to spawn F-15's?  I mean F-15 falls under Flaming Cliffs.

 

Moose RAT uses a "template" Group that you have to place on the mission and set as "Late activation". If you want F-15s then that Template should correspond to that type. RAT actually spawns Groups, so you can easily spawn up to 4-ship Groups.

 

Edit: Please note that the name of the group is not relevant, the group may be named "cessna" on the script but if the template group is an F-15, then that's what will be spawn.

 

 


Edited by Rudel_chw
  • Like 1

 

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

Quote

If you want F-15s then that Template should correspond to that type.

Thank you, that makes sense.  So in the .lua it can be called anything, the aircraft type is defined when the aircraft object is placed in the editor.

 

As for the liveries/skins, can I only define the liveries saved under Saved Games\DCS\Mods in the .lua script?

The reason I ask is because I have a ton of skins inside DCS, in the actual module folder.  So if the answer is yes, then I would have to move them out.

Maintain thy airspeed lest the ground rise up and smite thee!

YiizHx5.gif

Link to comment
Share on other sites

1 minute ago, ZoRPA said:

Thank you, that makes sense.  So in the .lua it can be called anything, the aircraft type is defined when the aircraft object is placed in the editor.

 

Correct, for example this is the Static Template that I use to setup background air traffic for the blue coalition: I use 6 types, a C-130, a C-17 and 4 types of helicopters. The transport types are single aircraft Groups, while the helos are 2-ship groups:

 

HThq9d3.jpg

 

Note that the template aircraft don't need waypoints, their flight plan will be auto-generated by RAT. The spawned aircrafts will hav ethe livery that you chose for the Template aircraft, unless you use the "Livery" statement on the LUA script.

 

5 minutes ago, ZoRPA said:

As for the liveries/skins, can I only define the liveries saved under Saved Games\DCS\Mods in the .lua script?

The reason I ask is because I have a ton of skins inside DCS, in the actual module folder.  So if the answer is yes, then I would have to move them out.

 

You can use whatever livery you have available for that aircraft type, it doesn't matter where is stored ... tough I must say that having custom liveries mixed within the DCS program folder is very bad practice .. if you perform a dcs repair they may be wiped out. On my case, the DCS program folder has only the official liveries of every module or vehicle, the custom liveries are at my Saved Games folder:

 

KCp2NtL.jpg

🙂

  • Like 1

 

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

It is interesting that your Liveries is a stand alone folder.

Mine is saved like this-

C:\Users\username\Saved Games\DCS\Mods\Aircraft\Civil Aircraft Mod\Liveries\A_320

 

But inside DCS, here is an example for the KA-50-

D:\DCS World\Bazar\Liveries\ka-50\german fictional camo 8325

Maintain thy airspeed lest the ground rise up and smite thee!

YiizHx5.gif

Link to comment
Share on other sites

  • 2 weeks later...

How much effort is it to use it?

One important aspect in the design of RAT was to keep it simple and easy to use even for people who are not so familiar with lua scripting but also very flexible at the same time. The most basic example needs two lines of simple lua code. But there are many options for fine tuning.

 

 

 

It's confusing.. adding traffic is totally awesome but this looks more complex? .. I will test

 


Edited by theGozr

Fly it like you stole it..

Link to comment
Share on other sites

2 hours ago, theGozr said:

.. if we need to add lines well it's more complex

 


it’s much easier than programming the thousands of lua lines myself, I only have to do a few (say, 20) lines of code, and then reuse them on every mission I edit.
 

If you want simpler then you are probably on the wrong game, try Arma 3.


Edited by Rudel_chw
  • Like 1

 

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

37 minutes ago, Rudel_chw said:


it’s much easier than programming the thousands of lua lines myself, I only have to do a few (say, 20) lines of code, and then reuse them on every mission I edit.
 

If you want simpler then you are probably on the wrong game, try Arma 3.

 

LOL I really want to use it ..  instead of  telling me about ARMA3  just tell me your impression about the software.. You started well but finish poorly.. I want to use it just a bit confused of what to really do..  Really want to give it a go because I like traffic .  Ty

Fly it like you stole it..

Link to comment
Share on other sites

Watch YouTuber tutorials, is all there.

 

For me this is really impressive.

For example: I'm trying to build a real life civilian traffic. All planes are individually spawned on the real air routes, every plane have a number and a different livery with keeping a different altitudes like irl controllers would manage. All will land in appropriate airports when get order to land. All this is randomised.

When at the start of a military operation in a region, having all airliner planes all over the palce, than all slowly trying to avoid a conflict area and been grounded, I had to accomplish a BVR mission. Things get complicated rapidly, not just when shooting a missile in heavy air traffic. Avoiding collisions in mid air, heavy air traffic, closed airports and redirections.

Doing this manually? Manually in ME you can at most set up a few airplanes flying some dump waypoints.

  • Like 1
Link to comment
Share on other sites

On 3/19/2021 at 11:09 PM, theGozr said:

what is the point of the app ? It's still unclear to me..  if we can do it manually


The important thing to realise is that RAT isn't an app or a mod. It's an extension to a scripting API called MOOSE (Mission Object-Oriented Scripting Environment). RAT makes it easy to write LUA scripts to populate the map with randomised air traffic, but it doesn't do the job for you. That's why it's in the Mission Editor section rather than the Mods and Apps section.

RAT is only going to be of use to you if you understand at least the basics of LUA scripting and are interested in writing your own scripts.


Edited by Pizzicato
  • Like 1

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

12 hours ago, Glow said:

Watch YouTuber tutorials, is all there.

 

For me this is really impressive.

For example: I'm trying to build a real life civilian traffic. All planes are individually spawned on the real air routes, every plane have a number and a different livery with keeping a different altitudes like irl controllers would manage. All will land in appropriate airports when get order to land. All this is randomised.

When at the start of a military operation in a region, having all airliner planes all over the palce, than all slowly trying to avoid a conflict area and been grounded, I had to accomplish a BVR mission. Things get complicated rapidly, not just when shooting a missile in heavy air traffic. Avoiding collisions in mid air, heavy air traffic, closed airports and redirections.

Doing this manually? Manually in ME you can at most set up a few airplanes flying some dump waypoints.

Yes !!! This is what I love and want to try

 

1 hour ago, Pizzicato said:


The important thing to realise is that RAT isn't an app or a mod. It's an extension to a scripting API called MOOSE (Mission Object-Oriented Scripting Environment). RAT makes it easy to write LUA scripts to populate the map with randomised air traffic, but it doesn't do the job for you. That's why it's in the Mission Editor section rather than the Mods and Apps section.

RAT is only going to be of use to you if you understand at the basics of LUA scripting and are interested in writing your own scripts.

 

Thanks for this clear answer

 

 


Edited by theGozr
  • Like 1

Fly it like you stole it..

Link to comment
Share on other sites

  • 2 weeks later...
On 3/21/2021 at 3:32 AM, Rudel_chw said:


it’s much easier than programming the thousands of lua lines myself, I only have to do a few (say, 20) lines of code, and then reuse them on every mission I edit.
 

If you want simpler then you are probably on the wrong game, try Arma 3.

 

 

Yeah, bad analogy. If you want something way more complex, way more involved scripting wise, way more modable, way more involved then its Arma. DCS is nowhere even remotely close to Arma in this manner. I'm talking in mission design, scripting, modding. Having said that you can also do things a lot simpler in Arma scripting as well because it was made for that and has about 1000x more available to it than DCS scripting engine does.

Link to comment
Share on other sites

6 minutes ago, Delta99 said:

Yeah, bad analogy. If you want something way more complex, way more involved scripting wise, way more modable, way more involved then its Arma. 

 

What I want is to learn to fly aircrafts ... programming a scripting language has got to be the least fun activity I can think of, and because of that I'm grateful for all the great work that Funky Franky did with RAT.  Also, I have zero interest in playing or learning the game you mention ... hence zero interest too in learning its scripting.

  • Like 1

 

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

I have been using this script for quite a while now and I am very happy with it. I just have one question to ask.

How do I make the planes/helos ignore neutral airfields?

I use the commands SetDeparture({"AF's names"}), SetDestination({"AF's names"}),SetCoalition"sameonly" but I can't seem to have the

planes ignore neutral airfields. Is there any way to have them takeoff and land at only the AF's that I designate?

They will ignore AF's of the opposite coalition, but they still want to use neutral fields even though departure and destination are set.

 

In addition, is there a way to set speed and altitude on RAT scripts? (I know, I said one question)  😀


Edited by rayrayblues

🇺🇦  SLAVA UKRAINI  🇺🇦

MoBo - ASUS 990FX R2 Sabertooth,     CPU - AMD FX 9590 @4.7Gb. No OC
RAM - GSkill RipJaws DDR3 32 Gb @2133 MHZ,   GPU - EVGA GeForce GTX 1660Ti 6Gb DDR5 OC'd, Core 180MHz, Memory 800MHz
Game drive - Samsung 980 M.2 EVO 1Tb SSD,    OS Drive - 860 EVO 500Gb SATA SSD, Win10 Pro 22H2

Controls - Thrustmaster T-Flight HOTAS X,   Monitor - LG 32" 1920 X 1080,   PSU - Prestige ATX-PR800W PSU

Link to comment
Share on other sites

I use these kind of options on my missions, and the rat aircrafts then fly only between same coalition airbaseses:

 

local c17=RAT:New("RAT-C17")
c17:SetCoalitionAircraft("blue")
c17:SetCoalition("sameonly")
c17:SetTakeoff("cold")
c17:ExcludedAirports("Batumi")
c17:Spawn(2)

 

 

 

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

On 3/30/2021 at 7:27 PM, Rudel_chw said:

 

What I want is to learn to fly aircrafts ... programming a scripting language has got to be the least fun activity I can think of, and because of that I'm grateful for all the great work that Funky Franky did with RAT.  Also, I have zero interest in playing or learning the game you mention ... hence zero interest too in learning its scripting.

 

This thread was about scripting not about flying. Your response was about scripting not flying. I responded about scripting not flying. You're telling someone else that this game isn't for them because of the complexities of scripting yet your analogy was completely wrong. And that is all I was pointing out.

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