Jump to content

Recommended Posts

You can simply add

yak:SetDestination({"RAT Zone North"})

and remove

yak:DestinationZone("RAT Zone North")

That line is only useful if you specify airbases as destination but only want them to fly there and not land.

  • Like 1

A warrior's mission is to foster the success of others.

i7-8700K | Asus RTX 2080Ti Strix OC | 32 GB Ram 3200 MHz DDR-4 | Asus Maximus Hero X | Samung EVO 960 Pro SSD | VKB Gunfighter Pro | MFG Crosswind | Rift S

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to post
Share on other sites
  • 2 weeks later...
  • Replies 575
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi guys,   I have been working on a new implementation - simply named RAT - to generate random air traffic. This is something I was missing a lot in many of my missions :)   So what is RAT about? R

Hello,   The actual script that is inside the mission isn't the one you show above .. .it is this one:   local yak=RAT:New("RAT_YAK") yak:Spawn(5)   When you edit a scr

RAT Tutorials   Part 1: Introduction and Concepts   Part 2: Examples and Options     Step-by-step Setup Guide   Step 1: First, you need to

spawning air traffic normally, but no matter which way I script it, never uses random liveries, any idea what I'm doing wrong?

 

 

local a320=RAT:New("RAT_a320")
local a320skins={"Turkish Airlines TC-JUJ", "Vietnam Airlines VN-A308", "cebu pacific RP-C4107" }

a320:SetTakeoffAir()
a320:Spawn(5)
a320:Livery(a320skins)

Hebrews 13:2

 

“Be not forgetful to entertain strangers: for thereby some have entertained angels unawares.”

Link to post
Share on other sites
spawning air traffic normally, but no matter which way I script it, never uses random liveries, any idea what I'm doing wrong?

 

 

local a320=RAT:New("RAT_a320")
local a320skins={"Turkish Airlines TC-JUJ", "Vietnam Airlines VN-A308", "cebu pacific RP-C4107" }

a320:SetTakeoffAir()
a320:Spawn(5)
a320:Livery(a320skins)

 

You need to wrap your Skins in Brackets

local a320skins=({"Turkish Airlines TC-JUJ", "Vietnam Airlines VN-A308", "cebu pacific RP-C4107" })

 

All Values must be contained in the Brackets () and Curly Braces {} are used to define an array of values within if you want more than one value possible.

Intel i9-9900KF @5.2GHz

MSI Z390 Gaming Pro Carbon

32GB G.Skill Trident Z DDR3200 RAM

MSI RTX 2080 Ti Gaming X Trio

40" Panasonic TH-40DX600U @ 4K

Pimax Vision 8K Plus / Oculus Rift CV1 / HTC Vive

Gametrix JetSeat with SimShaker

Windows 10 64 Bit Home Edition

 

[sIGPIC][/sIGPIC]

Link to post
Share on other sites

 

You need to wrap your Skins in Brackets

local a320skins=({"Turkish Airlines TC-JUJ", "Vietnam Airlines VN-A308", "cebu pacific RP-C4107" })

 

All Values must be contained in the Brackets () and Curly Braces {} are used to define an array of values within if you want more than one value possible.

 

update: Seemed to be causing an error when calling a particular livery, replaced the Air Vietnam, and oddly started working

 

Thanks for the reply @Highwayman-Ed, Tried it, still just defaults to solid white skin for all of them

 

note: also found this in log file

2020-11-15 20:32:56.414 ERROR Lua::Config: load error livery = {
{"Airbus_A320", 0, "airbus_a320_AAS.dds",false},
{"Airbus_A320", 1, "airbus_a320_b.jpg",true},
{"Airbus_A320", ROUGHNESS_METALLIC, "Airbus_A320_RoughMet.dds",true},​
{"Boeing_Metall", ROUGHNESS_METALLIC, "Boeing_Metall_RoughMet.dds",true},

}
name = "Air Asia HS-BBW"

Hebrews 13:2

 

“Be not forgetful to entertain strangers: for thereby some have entertained angels unawares.”

Link to post
Share on other sites

There's a part there that seems to be conflicting, at least to me anyway. You have the section

 

 

local a320skins={"Turkish Airlines TC-JUJ", "Vietnam Airlines VN-A308", "cebu pacific RP-C4107" }

 

but then later you're calling;

 

a320:Livery(a320skins)

 

This might be causing issues for you. Here is a snip from one of my RAT scripts;

 

 

local a320out=RAT:New("RAT_A320")
a320out:SetDeparture({"Beirut-Rafic Hariri","Adana Sakirpasa"})
a320out:DestinationZone({"European Gateway","Tel Aviv"})
a320out:Livery({"Aeroflot", "Air France", "Al Maha", "Egyptair", "Emirates", "Emirates SkyCargo 1", "Kuwait Airways", "MEA", "Turkish Airlines"})
a320out:SetMaxRespawnTriedWhenSpawnedOnRunway(0)
a320out:StatusReports(false)
a320out:SetSpawnDelay(math.random(300,600))
a320out:Invisible(true)
a320out:SetSpawnInterval(600)
a320out:SetTakeoff("cold")
a320out:RespawnInAirNotAllowed()
a320out:RespawnAfterTakeoff()
a320out:Spawn(1)

 

The liveries themselves are from the folder names in your liveries directory, not the livery names as they appear in-game.

  • Like 1

Intel i9-9900KF @5.2GHz

MSI Z390 Gaming Pro Carbon

32GB G.Skill Trident Z DDR3200 RAM

MSI RTX 2080 Ti Gaming X Trio

40" Panasonic TH-40DX600U @ 4K

Pimax Vision 8K Plus / Oculus Rift CV1 / HTC Vive

Gametrix JetSeat with SimShaker

Windows 10 64 Bit Home Edition

 

[sIGPIC][/sIGPIC]

Link to post
Share on other sites

 

to solve my problem... the Destination Zone must be in range... so set maxdistance to higher value, it works... but error message is pretty confusing. :-)

 

and... i use RAT on Syria... it is functional...

 

Try removing the two dashes in front of lines 4,5 and 6

That should eliminate the destination error. Let me know.

 

local c130skins={"Oman Air Force"}

local c130={}

c130.outbound=RAT:New("RAT_C-130", "Hercules Traffic")

-- c130.outbound:SetDeparture("Liwa Airbase")

-- c130.outbound:SetDestination("Al Dhafra AB")

-- c130.outbound:Livery(c130skins)

 

 

 

 

[sIGPIC][/sIGPIC]

Link to post
Share on other sites
  • 3 weeks later...
  • 5 weeks later...

Many thanks for this powerful script, but I need your help: RAT works great using the sample script which generates a few Yaks, but I couldn't manage to create flights from the Civil Aircraft Mod (CAM).

 

Additionally to the Yak I've created a 737-template (group name "RAT_B737", late activation boxed) and extended the simple RAT script for the 737, but it won't work, only the Yaks are spawning.

local yak=RAT:New("RAT_YAK")
yak:Spawn(6)

local boeing737=RAT:New("RAT_B737")
boeing737:Spawn(3)

 

 

CAM is installed well. Manually adding flights from the CAM, i. e. 737 in the ME works great. What am I doin' wrong?

 

Mission:

 

(removed)

 

Versions:

  • DCS: Current OB
  • CAM: 0.8.6
  • MOOSE: 2.5.2

Edited by AstonMartinDBS

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites
On 12/4/2020 at 9:09 AM, 9thHunt said:

this doesn't effect existing missions, right?  This is just for adding AI to user missions?

Exactly. Existing missions are not affected, but you can improve your old missions with RAT if you wish.

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites
4 hours ago, AstonMartinDBS said:

Many thanks for this powerful script, but I need your help: RAT works great using the sample script which generates a few Yaks, but I couldn't manage to create flights from the Civil Aircraft Mod (CAM).

 

Additionally to the Yak I've created a 737-template (group name "RAT_B737", late activation boxed) and extended the simple RAT script for the 737, but it won't work, only the Yaks are spawning.


local yak=RAT:New("RAT_YAK")
yak:Spawn(6)

local boeing737=RAT:New("RAT_B737")
boeing737:Spawn(3)

 

 

CAM is installed well. Manually adding flights from the CAM, i. e. 737 in the ME works great. What am I doin' wrong?

 

Hello,

 

The actual script that is inside the mission isn't the one you show above .. .it is this one:

 

local yak=RAT:New("RAT_YAK")
yak:Spawn(5)

 

When you edit a script outside of DCS (say, with Notepad++) the copy that is inside the MIZ file does not update automatically, you need to update the trigger, by clicking on OPEN and selecting the updated script on your disk:

 

8znt50T.jpg

  • Like 1
  • 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 3600 - 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 post
Share on other sites
6 hours ago, Rudel_chw said:

When you edit a script outside of DCS (say, with Notepad++) the copy that is inside the MIZ file does not update automatically, you need to update the trigger, by clicking on OPEN and selecting the updated script on your disk

Now, that I wouldn't have thought of! Many thanks for this hint @Rudel_chw! You made my day, RAT works great! 👍

 

 

 


Edited by AstonMartinDBS

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites

Need a bit of help with RAT for DCS. I downloaded the latest Moose.lua file and followed the instructions to create and name the Airplane group (RAT_SP), set the Airplane Type (Spitfire), select LATE ACTIVATION, create the script lua file (RAT_SP.lua), create the two triggers (Load Moose and Load Mission Script), save and start mission. But I never see any aircraft spawn. Moose.lua version is 2.5.2. My script file is attached. I store both in a folder on my desktop. Any help appreciated. Thanks

RAT_SP.lua

Link to post
Share on other sites
1 hour ago, Dave23913 said:

I downloaded the latest Moose.lua file and followed the instructions to create and name the Airplane group (RAT_SP), set the Airplane Type (Spitfire), select LATE ACTIVATION, create the script lua file (RAT_SP.lua), create the two triggers (Load Moose and Load Mission Script), save and start mission. But I never see any aircraft spawn. Moose.lua version is 2.5.2. My script file is attached. I store both in a folder on my desktop.

Sounds good, but provide your mission file (.miz), please. And consider this hint:

 

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites
36 minutes ago, Dave23913 said:

My mission file is attached

 

Your mission file contains this (outdated) script:

local yak=RAT:New("RAT_YAK")
yak:Spawn(5)

but you wanna have this one:

local sp=RAT:New("RAT_SP")
sp:SetDeparture("Gudauta")
sp:Spawn(5)

 

I had exactly the same issue (see a few posts above). Every time you make changes to the script, you have to re-open/reload the script via your trigger so that it is also updated in the .miz file. Follow the notes from @Rudel_chw:

 

On 1/3/2021 at 3:57 PM, Rudel_chw said:

When you edit a script outside of DCS (say, with Notepad++) the copy that is inside the MIZ file does not update automatically, you need to update the trigger, by clicking on OPEN and selecting the updated script on your disk:

 

8znt50T.jpg

 

 


Edited by AstonMartinDBS

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites

Hello,

 

Actually, the mission problem has another cause .. the triggers to load Moose and then the RAT script are set to occur at the same time, like this:

 

deixklQ.jpg

 

This doesn't work because Moose requires a few seconds to load, so when the script runs Moose is not active yet. You have to use the TIME condition to ensure that one trigger runs first and then the other. The trigger list is not intuitive, because it looks like the top trigger will run first and then the next and then the next one, etc .. but this is not true at all.

 

Set the triggers like this:

 

1hdlBFj.jpg

 

Then the script will work.

 

You will find out that your script is too simple, as it will spawn 5 Mustangs on random airfields all over Caucasus .. so your player aircraft will most likely never meet them. You can change the script to this:

 

local yak=RAT:New("RAT_YAK")
yak:SetCoalitionAircraft("blue")
yak:SetCoalition("sameonly")
yak:SetTakeoff("cold")
yak:Spawn(5)

 

This will spawn only on Blue airfields .. set to Blue only the airfields close to Gudauta and the random traffic will be closer to your player.

 

 

  • 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 3600 - 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 post
Share on other sites

@Rudel_chw - Thanks for helping with this - truly appreciate your time! The mission was only a test so I wasn't too concerned with where they spawned - I was looking at the map just to see if anything spawned. But I appreciate the script suggestion. I'll test out the trigger change and hope to see that it works. Thanks again!!

Link to post
Share on other sites
1 minute ago, Dave23913 said:

@Rudel_chw - Thanks for helping with this - truly appreciate your time! The mission was only a test so I wasn't too concerned with where they spawned - I was looking at the map just to see if anything spawned. But I appreciate the script suggestion. I'll test out the trigger change and hope to see that it works. Thanks again!!


here is your test mission, updated 🙂

RAT_TEST.miz

 

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 3600 - 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 post
Share on other sites
20 hours ago, Rudel_chw said:

This doesn't work because Moose requires a few seconds to load, so when the script runs Moose is not active yet. You have to use the TIME condition to ensure that one trigger runs first and then the other. The trigger list is not intuitive, because it looks like the top trigger will run first and then the next and then the next one, etc .. but this is not true at all.

 

Optionally you can set the trigger type to "4 MISSION START" without the condition "TIME MORE".

This seems to force DCS to process the scripts sequential.

20210108 ME Loading RAT Script.jpg

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites

try that on the OP mission ... does it really work?


Edited by Rudel_chw

 

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 3600 - 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 post
Share on other sites
1 hour ago, Rudel_chw said:

try that on the OP mission ... does it really work?

Yes, it works. Change both trigger types to "4 MISSION START" and remove the condition "TIME MORE" from both triggers. I only had to replace the player's P-51 with the standard TF-51, because I don't own the P-51.

 

Here is your corresponding adapted mission from above - just test it:

RAT_TEST_rudel.miz


Edited by AstonMartinDBS

[Modules] A-10C, A-10C II, F-14A/B, F-16C, F/A-18C, FC3, Ka-50, UH-1H, CA, SC

[Maps] PG, NTTR, Normandy, Syria

[PC] Z270F, i7-7700K, 64 GB DDR4-2666, RTX 2080 SUPER 8 GB GDDR6, SSD 970 EVO Plus 1 TB (M.2), 2 x SSD 850 EVO 500 GB (SATA3), 2 TB HDD, TM HOTAS Warthog (Grip@WarBRD Base), MS SW FFB2, Thrustmaster TFRP, TrackIR 5 & TrackClip Pro

[Checklists] A-10C, F-16C, F/A-18C, Ka-50, UH-1H

Link to post
Share on other sites

Thanks, I enjoy learning new tips 👍 will try it tonight.

  • 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 3600 - 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 post
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...