[MOOSE] RAT - Random Air Traffic - Page 47 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 03-29-2020, 11:56 AM   #461
Pikey
Veteran
 
Pikey's Avatar
 
Join Date: Sep 2009
Location: Reading, UK (GMT)
Posts: 4,334
Default

https://github.com/FlightControl-Mas...affic/Caucasus

Your best approach is to take a sample mission then change it to suit once it makes more sense. Link above, look through them.
1. The files are in the example. Use a zip extractor to open it. Run it first, see what it does, then look at what made it happen. Then tinker.
2. Notepad is fine. Notepad++ would be better for you, depends how long you do it for.
3. Your mission script can contain more than RAT things, You don't need to seperate them out, you can put in as much scripting as you want to in the same script. You can create two scripts if you like, which is sometimes easier to compartmentalise. I think there's more than 20 files on my server, it really doesnt matter.
__________________
___________________________________________________________________________
SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING * PLAYLIST
===========
Pikey is offline   Reply With Quote
Old 03-29-2020, 11:15 PM   #462
Tread_Head57
Member
 
Join Date: Sep 2014
Posts: 229
Default

Quote:
Originally Posted by Pikey View Post
.
Thanks for the link and advice. I’ll try it tonight.
Tread_Head57 is offline   Reply With Quote
Old 03-31-2020, 08:14 PM   #463
Tread_Head57
Member
 
Join Date: Sep 2014
Posts: 229
Default

I've gotten the aircraft to randomly spawn and fly around. However I can't get the random liveries to work. Below is my RAt.Lua code. Does anyone know what I'm doing wrong? I've trimmed the amount of liveries so it fits better in this post. Thanks.
_____________________________
local A320=RAT:New("RAT_A320")
A320:Spawn(5)
A320:SetMinDistance(100)
A320:Livery(A320skins)

local B727=RAT:New("RAT_B727")
B727:Spawn(5)
B727:SetMinDistance(100)
B727:Livery(B727skins)

local B737=RAT:New("RAT_B737")
B737:Spawn(5)
B737:SetMinDistance(100)
B737:Livery(B737skins)

local A380=RAT:New("RAT_A380")
A380:Spawn(3)
A380:SetMinDistance(100)
A380:Livery(a380skins)

local B757=RAT:New("RAT_B757")
B757:Spawn(5)
B757:SetMinDistance(100)
B757:Livery(B757skins)

local B747=RAT:New("RAT_B747")
B747:Spawn(3)
B747:SetMinDistance(100)
B747:Livery(B747skins)

local B727skins={"AEROFLOT", "Air France", "Alaska"}
local B737skins={"Air Algerie", "Air Berlin", "UPS"}
local B747skins={"AI", "CP", "KLM", "LH", "NW", "PA", "QA"}
local B757skins={"AA", "BA", "C-32", "Delta", "DHL"}
local A380skins={"Air France", "BA"}
local A320skins={"Aeroflot", "Aeroflot 1", "Air Asia"}

Last edited by Tread_Head57; 03-31-2020 at 08:17 PM.
Tread_Head57 is offline   Reply With Quote
Old 03-31-2020, 08:32 PM   #464
Rudel_chw
Veteran
 
Join Date: Nov 2013
Location: Antofagasta, Chile
Posts: 6,450
Default

Place the local definitions at the top of the file rather than at the bottom.
__________________
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: 27" Monitor - Ryzen 1500X - 32 GB DDR4 2400 - MSI GTX970 - SSD 1.25 TB - HDD 10 TB - Windows 10 Pro - Thrustmaster HOTAS Cougar - Oculus Rift CV1
Mobile: iPad Pro 12.9" of 256 GB
Rudel_chw is online now   Reply With Quote
Old 04-01-2020, 04:48 AM   #465
Tread_Head57
Member
 
Join Date: Sep 2014
Posts: 229
Default

Quote:
Originally Posted by Rudel_chw View Post
Place the local definitions at the top of the file rather than at the bottom.
That fixed it. Thank you.
Tread_Head57 is offline   Reply With Quote
Old 04-01-2020, 05:47 AM   #466
Tread_Head57
Member
 
Join Date: Sep 2014
Posts: 229
Default

Next question (please keep in mind I have exactly 3 days .lua coding experience) is how to code specific aircraft flying only to a designated selection of airfields? I currently have 5x different types of civilian aircraft, with random liveries, flying to random airports all over the SoH map (except for the small island airports, which I turned "red" since the landing strips were too small). My goal is to have 3 different groups: 1) civilian airliners flying randomly to all civilian airports throughout the SoH map; 2) Iranian military aircraft flying randomly to all Iranian military airfields; 3) and "blue" military aircraft flying randomly to all "blue" military airfields. My questions are:

1: Exactly how to I tell a specific aircraft group (say the B747) which airfields I want it to use for takeoff/landing?

2: Where do I get the correct airfield name to use in the coding? The name off the mission editor? Somewhere else?

3: My current .lua code is posted above, with the correction Rudel made. Where in the lines of code should these instructions go?

4: I don't know what I don't know... is there anything else I'm missing to make this work?

Thanks.
Tread_Head57 is offline   Reply With Quote
Old 04-01-2020, 12:38 PM   #467
Rudel_chw
Veteran
 
Join Date: Nov 2013
Location: Antofagasta, Chile
Posts: 6,450
Default

Quote:
Originally Posted by Tread_Head57 View Post
... My questions are:

1: Exactly how to I tell a specific aircraft group (say the B747) which airfields I want it to use for takeoff/landing?
Use the options SetDeparture and SetDestination, like this:

Code:
b747:SetDeparture({"Al Maktoum Intl", "Dubai Intl", "Sharjah Intl", "Fujairah Intl", "Shiraz International Airport", "To Asia", "To Europe"}) 
b747:SetDestination({"Al Maktoum Intl", "Dubai Intl", "Sharjah Intl", "Fujairah Intl", "Shiraz International Airport", "To Asia", "To Europe"})
"To Asia" and "To Europe" are not airfields, but trigger zones names that I use for map outbound and inbound traffic, in order to not have only within-map traffic .. very useful for the larger aircrafts.

Quote:
2: Where do I get the correct airfield name to use in the coding? The name off the mission editor?
Yes, the names they have on the ME, be careful with the casing.

Quote:
3: My current .lua code is posted above, with the correction Rudel made. Where in the lines of code should these instructions go?
I place them like this:

Code:
local b747=RAT:New("RAT-B747")
b747:Livery(b747skins)
b747:SetCoalitionAircraft("neutral")
b747:SetCountry(country.id.SWITZERLAND)
b747:SetDeparture({"Al Maktoum Intl", "Dubai Intl", "Sharjah Intl", "Fujairah Intl", "Shiraz International Airport", "To Asia", "To Europe"}) 
b747:SetDestination({"Al Maktoum Intl", "Dubai Intl", "Sharjah Intl", "Fujairah Intl", "Shiraz International Airport", "To Asia", "To Europe"}) 
b747:Spawn(2)
Quote:
4: I don't know what I don't know... is there anything else I'm missing to make this work?
To avoid the planes from being attacked by either red or blue, I place my civil aircrafts on a country that is neutral, on this example: Switzerland.

Best regards
__________________
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: 27" Monitor - Ryzen 1500X - 32 GB DDR4 2400 - MSI GTX970 - SSD 1.25 TB - HDD 10 TB - Windows 10 Pro - Thrustmaster HOTAS Cougar - Oculus Rift CV1
Mobile: iPad Pro 12.9" of 256 GB
Rudel_chw is online now   Reply With Quote
Old 04-02-2020, 06:51 AM   #468
Tread_Head57
Member
 
Join Date: Sep 2014
Posts: 229
Default

Rudel,

Thanks for your continued help. I have the civilian airliners flying to all civilian airports (added all on the map and narrowed down the selection for 747's and A380s). I followed your code for making civilian airliners neural and it's working as well. I also have "blue" military aircraft/helicopters flying randomly to all "blue" airfields. I ran the mission about 4 times without a fly-able plane just to observe. I noticed some interesting observations:

1: With civilian airliners set to neural, they don't show up on the F10 map. I played with the mission editor and can't figure out how to get them to show up.

2. Every time I've run a test, I've increased the time to speed it up. For reference, the start time is 1700 on 01JUN2020. By the time the sun is dipping below the horizon, almost all civilian aircraft are stuck in a left hand orbit. Most aircraft stuck in this orbit are outside of visual distance of an airfield. It's weird, everything works well for a while (takeoff-land-disappear-respawn-takeoff-...), but then civil airliners get stuck in this orbit. This was also the case for "blue" aircraft from the Military Aircraft Mod (C-5) and standard DCS aircraft (C-130 and C-17).

3: Helicopters (CH-47 and UH-60) like to spawn on top of each other. I have 2 of each programmed (4 total) with, I believe, 5 military airbase options for takeoff/landing. In 3 of 4 testing runs the UH-60s have spawned on top of the CH-47s preventing either of them from moving. In the one testing scenario where this worked, one UH-60 spawned on top of a CH-47 while the second UH-60/CH-47 spawned separately and actually flew around as they were supposed to.

Last edited by Tread_Head57; 04-02-2020 at 06:55 AM.
Tread_Head57 is offline   Reply With Quote
Old 04-02-2020, 02:09 PM   #469
Rudel_chw
Veteran
 
Join Date: Nov 2013
Location: Antofagasta, Chile
Posts: 6,450
Default

Quote:
Originally Posted by Tread_Head57 View Post
1: With civilian airliners set to neural, they don't show up on the F10 map. I played with the mission editor and can't figure out how to get them to show up.
Unfortunately, you can't ... DCS won't show neutral units on the Map. If you want them to show up there (why you need that? ) then assign them to a Red or Blue country, howevere they could get attacked by enemy AI.

Quote:
2. Every time I've run a test, I've increased the time to speed it up. For reference, the start time is 1700 on 01JUN2020. By the time the sun is dipping below the horizon, almost all civilian aircraft are stuck in a left hand orbit. Most aircraft stuck in this orbit are outside of visual distance of an airfield. It's weird, everything works well for a while (takeoff-land-disappear-respawn-takeoff-...), but then civil airliners get stuck in this orbit. This was also the case for "blue" aircraft from the Military Aircraft Mod (C-5) and standard DCS aircraft (C-130 and C-17).
I haven't noticed that .. here is a Mission I setup today as test, where the mission runs two hours without encountering what you describe:

https://1drv.ms/u/s!Ai6cuX3YQI26hJgm...vQTNg?e=0um4oX

and here a video running it at 10x time:



Yes, the AI does really silly maneouvers, but at 1X speed they go unnoticed

Quote:
3: Helicopters (CH-47 and UH-60) like to spawn on top of each other.
Yes, it happens to me too, altough not that frequently .. the author of RAT, FunkyFranky, took a look at it but couldnt fix this bug

Anyways, for my missions at least (I mostly fly Single player). the RAT does work fairly well and so it is a great tool to add ambiance around my airbases.

Best regards
__________________
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: 27" Monitor - Ryzen 1500X - 32 GB DDR4 2400 - MSI GTX970 - SSD 1.25 TB - HDD 10 TB - Windows 10 Pro - Thrustmaster HOTAS Cougar - Oculus Rift CV1
Mobile: iPad Pro 12.9" of 256 GB

Last edited by Rudel_chw; 04-02-2020 at 02:42 PM.
Rudel_chw is online now   Reply With Quote
Old 04-02-2020, 03:41 PM   #470
Ultramikon
Junior Member
 
Join Date: Jan 2018
Posts: 3
Default

Hey,

Ive been playing around with RAT and CAM and noticed one thing. It does not matter how many Aircraft I am Spawning in, somehow it wouldnt be able to Spawn them in the Airbase Im in.

Example:
Im in Dubai Intl. I have 4 Aircraft Types summing up to 40 Aircraft. Absoulutely no Aircraft Spawn at Dubai Intl.

Any help on that?
Ultramikon is offline   Reply With Quote
Reply

Tags
moose, random air traffic, rat

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:41 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.