Jump to content

Random Airtraffic Script (with MIST2.0)


SNAFU

Recommended Posts

I've been trying to implement this for over an hour now- but things are a bit conflicted. In your script it says to call everything AF1 AF2 AF3- with ' ' around them... then name the airfields in the specific lines.

 

In your instructions on here it says to spell out airfield1 / 2 / 3

 

In the example mission, the airfields are spelled out in their entirety- irrespective of the tables given earlier in the thread. Sochi-Adler is spelled out as opposed to "Sochi" in the table...

 

Have things changed with your versions? Just wondering... I'm anxious to use the script but as simple as it sounds all I get is:

 

00029.891 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\Eno\AppData\Local\Temp\DCS\/~mis00..."]:4254: Parameter #1 (unit name string) missed

00030.809 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "--MIST 2.0 required..."]:33: attempt to index global 'AF1IDname' (a nil value)

00030.809 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "--MIST 2.0 required..."]:2787: attempt to index global 'AF1IDname' (a nil value)

00031.910 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\Eno\AppData\Local\Temp\DCS\/~mis00..."]:4254: Parameter #1 (unit name string) missed

 

This seems to point to a naming issue- which should be easy but as I've pointed out it's hard to nail down exactly what it's looking for in terms of format. (for the uninitiated)

 

Thanks snafu and sorry for the trouble.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Sorry, it seems I didn´t update the description in the 1st post, and the description in the *.lua file might be misleading. 'AF1' is meant as a place holder for the name you enter in line 12 to 14.

 

The triggerzone named the same as the airfield, the triggerzone represents and the same as in the script line 12, 13 and 14. So you basically look the the airfields, you want the AI to use for takeoff and landing, enter the name in the script line 12-14 and place a triggerzone with the same name above the airfield.

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

FYI a couple of Airdrome names have changed

 

Found that 26 MinVody isn't correct either, but I haven't found where to get the right name yet...

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 comment
Share on other sites

Okay- back at it again. I'm sorry... but I'm still stuck. I'm getting this error:

 

00033.445 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\Eno\AppData\Local\Temp\DCS\/~mis00..."]:33: attempt to index global 'AF1IDname' (a nil value)

00033.781 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\Eno\AppData\Local\Temp\DCS\/~mis00..."]:2582: attempt to index global '_destination' (a nil value)

 

What it seems to be saying is that the Batumi zone and the airlanehub1 doesn't exist?

 

 

Here are the lines to be edited (and yes all the zones are named EXACTLY like that (though I wasn't sure about the ' so I tried both with and without):

 

intervall = math.random(30,90) --random repeater intervall between (A and B) in seconds

Nameprefix = "A-" --Unit and Group name should not be used in ME by other units, this prefix can be altered if used by other scripts

AF1 = 'Batumi' --Exact name of airfield with the zone "Batumi"

AF2 = 'Kobuleti' --Exact name of airfield with the zone "Kobuleti"

AF3 = 'Kutaisi' --Exact name of airfield with the zone "Kutaisi"

 

 

I have the zone they need to fly to called airlanehub1.

 

I have MIST 3.3 running...


Edited by ENO

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Hmmh, did you crosscheck with the example mission?

 

It doesn´t matter if you declare the strings with ' or with " in the *.lua file, afaik LUA uses both to declare strings. The name in the ME should be without the ' or ".

 

Or you can load up your mission and I take a look, when I find the time.

  • Like 1

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

I think I've got it... was a bit of an issue with file locations and some other things. In my flailing it seems I've figured it out.

 

I've got it working... Sorry it was such a pain. I'm hoping to overlay it with existing missions now that I've gotten it figured out.

 

 

It really was as easy as you said- very straight forward.

 

I noticed in your mission you'd initialized it first and I tested it a variety of different ways once I got it working... with MIST 3.3 initialized and at mission start... all good.

 

Thanks SNAFU.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

I have new Hardware on my server now so I will also start hosting larger missions with all aircrafts active and this script is the way to go! Thanks for your hard work snafu. Does the CAP flights work as just protecting own borders or do they attack flights over on the other side of their own border?


Edited by HiJack
Link to comment
Share on other sites

Eno,Good you sorted it out, please report errors or hangs in the script. I hope I get the chance to rewrite the script and make it more effective and a little smarter... only time is the issue...

 

 

 

HiJack, I assume you are not you referring to this script (CAP/GCI script)...

 

The Random Airtraffic is simply ambiente, and the planes do not engage actively in combat. I think they are more like drones, don´t know if they even evade incoming fire...

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

The Random Airtraffic is simply ambiente, and the planes do not engage actively in combat. I think they are more like drones, don´t know if they even evade incoming fire...

Yes you are right I was thinking of the other script. Will be testing them today :D


Edited by HiJack
Link to comment
Share on other sites

Both the scripts works fine with Mist 3.3. The random traffic starts also randomly from red and blue bases. If we have a military situation between two countries there is not lightly to be any civil flights between the two countries once the fighting starts. Can you change the script so red units fly on red airfields and blue flights fly on blue airfields?

Link to comment
Share on other sites

Found that 26 MinVody isn't correct either, but I haven't found where to get the right name yet...

 

I have the list from the Mission Log Sorftware by AriesWings.

 

You can place an AI flight in the ME and set it takeoff, then you open the MIZ file and chech the Mission-file with Notepad and look for the ID in the unit-table behind "TAKE OFF PARKING", that is how you can easily get the ID of the airfield, if you don´t know the name, but I don´t know an easy way to get the correct name of airbase.

 

When you have the ID you could try by replacing <enter ID number here> with the ID:

local airfield = Airbase.getByID(<enter ID number here>)
local airfieldname = Airbase.getName(airfield)
trigger.action.outText(airfieldname, 60000000)

But that is purely experimental, since these functions are not documented anywhere in this way. Airbase.getByName() is existing and Unit.getName(Unitself) is exisit, but I don´t know if this is transferable on "Airbase" type.

 

@HiJack:

 

That is possible... I actually wanted to rewrite the script that all airports on the map are used and the type and color the plane spawns depend on the owner coalition of the airfield. But I do not see myself doing this in the near future. I have a general idea how to do this and the functions are availabe, but I have to work on a squad campaign before I get back to this.

 

But this was my first bigger script - actually quite simple - only getting the specifics for the plane-tables was an effort. With a little scripting knowledge the table can be taken and used quite easily for a script as described above. As said... only the time is missing...


Edited by SNAFU

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

Both the scripts works fine with Mist 3.3. The random traffic starts also randomly from red and blue bases. If we have a military situation between two countries there is not lightly to be any civil flights between the two countries once the fighting starts. Can you change the script so red units fly on red airfields and blue flights fly on blue airfields?

 

 

 

you can set which airframes you want to spawn...in my missions I make one script spawn only blue and one for only red....set the blue to only blue airfields and the red to the red airfields....

 

 

....what you want is very possible by running the script twice, instead of trying to make it decides which is red and which is blue...

 

 

....I have the original script running AF1, AF2, AF3, and airlanehub1......the copy the same script but set it up for AF4, AF5, AF6 and airlanehub2

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

When you set which planes are spawned they're divided as if Russia is red and I think a bunch of the other available aircraft are blue. Is there any way to skip numbers in that option line? Ie: aircraft 1-5,7-20 or something like that?

 

 

In the campaign I'm building, Georgia is red. (For example)

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

If you exchange line 1452 with line 1518 you the sorting as follows:

 

Georgia settled in the numbers between US and RUS:

   randomAirplane = math.random(1,18) -- random for airplanettype; US AC 1-8, Georgia AC 9, Russian AC 10-18
   randomHeli = math.random(1,18) -- US AC 1-10, Georgian AC 10-12, Russian AC 13-18
   randomFighter = math.random(1,36) --NATO AC 1-16, Georgian 17, Russian AC 18-36

Then you can split the types by editing the numbers in the math.random().

But I didn´t declare the most varaibles as locals since it caused some issues, therefore using the script twice in a mission might cause problems. I didn´t check this in depth, but forexample the "groupcounter" is global and therefore used by both scripts currently. This would need some overhaul to be sure, so feedback always welcome... ;)

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

I have not done extensive controlled environment testing...but at a glance...I got IADS(grimes) at time less 2, Random Traffic (blue) at time more 6, Random Traffic (red) at time more 12,.......no problems yet...this is with also playing with the settings and spawning an aircraft every 60 seconds resulting is 30 to 40 aircraft in the air at once.....ran it for about an hour testing the aircraft ROE.....results in random spawn dont attack (already known)....but when I added to your script trying (in the past, I now have your release of GCI) to get the traffic to attack, it did make every airplane a bigger CPU load (addition of AI, but still no combat)....so I removed that ROE part and your script is actually very resource lite because the random traffic is brain dead (no AI orders)....

 

....so while "Random Air Traffic" did not fit my needs at first....now that I'm playing with your GCI....i find your Dumb random traffic to be perfect.....

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

When you set which planes are spawned they're divided as if Russia is red and I think a bunch of the other available aircraft are blue. Is there any way to skip numbers in that option line? Ie: aircraft 1-5,7-20 or something like that?

 

 

In the campaign I'm building, Georgia is red. (For example)

 

 

 

 

OK...I faced this also because i only wanted Yak-40s and AN-26s....but they were not next to each other on the list... I had to adjust the list (no side effects)....alls I did was copy and paste the airframes close to each other on the list then pick the sequence of numbers that related to the few aircraft i needed.....this moved the planes i didnt want to used further down the list..

 

...in short...change planes 1 through 3 on the list to the planes you want them to be....move the three planes in spot 1 through 3 to the old spots you moved the needed planes from....list is still complete, just re organized to fit your needs....

 

...P.S.....i also found the need to change the current skins picked for said aircraft....once again...look ingame for the skins you wish to use...copy the name exactly....add it into the script where the incorrect skin for your airframe is....


Edited by Davis0079
  • Like 1

It only takes two things to fly, Airspeed and Money.

Link to comment
Share on other sites

  • 3 weeks later...

The script calling the mist.scheduleFunction gives the following error in dcs.log when run in multiplayer mode:

 

00033.291 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\Jack\AppData\Local\Temp\DCS\/~mis00..."]:4254: Parameter #1 (unit name string) missed

 

Is this critical? My testing crashes the server after about one hour when running the script.

 

This is the code failing:

Line 2561: Spawntimer = mist.scheduleFunction(generateAirplane, {}, timer.getTime() + 2, intervall)

 

or line 2682: Routingtimer = mist.scheduleFunction(generateRoute, {}, timer.getTime() + 3, intervall)

 

generateAirplane and generateRoute are functions and obviously it works as aircrafts are spawning with routes ;)


Edited by HiJack
Link to comment
Share on other sites

Ah, right in the old scripts I used the mist.scheduleFunction...

 

Do you use the script together with the GCI-CAP script? I assume some issues, when groups are deleted by both scripts, because the basically use the same function to clear up landed aircrafts cluttering the airfields, but so far that is just a wild guess.

 

I will take a look and see if I have an idea, posting or Pming the mission might help.

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

Well the mission is the supplied example but I have disabled the GCI-CAP script from running. The script error is still there. I will remove the GCI-CAP script completely and only run the Random Airtraffic script and test again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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