DCS Mission Editing Tools and Discussion

Thanks. Yeah, I’ve had no issues with some things (the Start/Stop condition and such). Seems it’d be nice to know at what point it considers you ‘at’ a waypoint. Must be REALLY close as I’ve tried to fly as close as possible for tests (as Client). I know it [the engine] knows when my Client flies over a waypoint.

Anyway, there’s usually another way to skin the cat. Thanks again.

I guess LUA is my first ‘scripting’ language off the top of my head. Some would say anything above ASM is a scripting language however :grin:

Messin with LUA (there’s a song in there, somewhere) has tingled my coding juices again. Think I’m going to write a little (ha!) app to help me, if no one else, make some sense out of the MIZ files. Stay tuned…though it’s gonna take a bit to get up to speed again…

  • Visual of the mission on a simple map
  • Ability to ‘scroll’ through the mission (timeline kinda thing), forwards & backwards, via nothing more than the mouse wheel (or similar)
  • Show relationships
  • Display NAMED VARIABLES instead of those stinkin numbers (flags)! Sorry, that drives me crazy.
1 Like

Yes…something sung to the tune of “Sit’n on the Dock of the Bay” by Otis Redding.

:musical_note: Mess’n with the L U A,
watching the script whirl away. :musical_note:

(You have to sing L, U, A separately or it doesn’t work.)

2 Likes

Also mission transposition between maps. So I can easily and quickly take a bunch of stuff from the Caucasus to Syria.

This is one of the things that got me to dust of the IDE. At the moment I don’t see why this won’t work, with the obvious exception that the coordinates will be wrong - no way around this of course but, if you can move everything else it should save a ton of time (triggers being the biggy).

Just finished a routine that loads the entire mission for display in the GUI. The app already has map support but it has limited data for certain theaters (it will create height maps so you’ll always have that for a topographic view of the terrain). I have a lot for the NTTR (airspace, navaids, fixes, etc).

Other than what you mentioned I’d like the ability to “play” the mission quickly (think “scroll” through it, forwards and backwards), showing when various trigger’d events happen, and check flags and such. Of course it will only be rough estimates of the positions of vehicles as it’s not really running the sim…speeds will be based on what have been input at each waypoint.

I hardly know coding, but as the coordinate difference between maps is fixed, might the thing not change those by a fixed amount? They’d still need manual fine-tuning but at least the patterns would still be there more or less.

Seems DCS used UTM coords (so far I’ve worked this all out); the issue is you’ll have to move units into place but of course there’s no way around that. They will remain at the same relative positions (unit A 100 units West of Unit B will be preserved).

However, off the top of my head, there may need to be some scaling here as, for example: you setup a mission on a big map with points so far apart they will be off the map when you move to a smaller theater. Just no way around this. In the end it should save a bunch of time though as it will move everything over. Now, I’ve not even tested this functionality so, we’ll see.

Seems you could even do it now; edit the mission file in the MIZ and change the name of the theater, then re-zip it all back up. Got to look into my code again (when I get to this feature) to see how the coordinates are used; I’m pretty sure all object coords. are offsets from a the map origin…I just don’t recall as the map functionality code was written a couple of years ago.

Add a scaling function to the coordinates for when it moves, that way you can squeeze things into the visible space and move them as needed in event of larger to smaller map.

The map origin is typically around the center of the detailed area in my experience.

Yup, that’s the plan. I’ve not looked at any other maps than the NTTR, but it’s origin is way North, which doesn’t matter, but I found it curious; this functionality was the first, mandatory, step to translate everything correctly.

FWIW, a bit of progress on what I’m calling “DCS Grok” - a [hopefully] way to keep track of, ‘visually’, just what the heck is going on in your mission; understand what all is there and when things happen, and to what (flags). The UI is slowly taking shape. Working on the Timeline feature.

The “Visual” part is going to require a compromise right now…I can display geographical stuff; the groups/units/routes/triggers/zones - the basics. But it seems ED has an odd way of defining the projection of their coordinate system. They seem non-standard and inconsistent (Syria is the strangest so far, but I don’t have all the maps).

Some maps perfectly (NTTR) display when I translate them, others not even close. And I can’t decipher the projection (seems they’ve hidden it away). Anyways, I don’t see it as a show-stopper as ‘Grok’ is designed; you’ll be able to see the map stuff but there just won’t be any map. Should be more clear later…

Here’s a snap-shot of the UI as of today. This is of course not even close to a closed alpha yet but at least you can see the following (or maybe not):

  • Broken out all the significant bits and ‘re-attached’ the cross-references: resources, dictionary (seems to be nothing more than a string table/dictionary)
  • Extracted all the ‘flags’ into a separate list allowing you to, a) see when they have ‘fired’ (to me flags are just state variables), their current value (0/False, 1/True, or > 0) and b) allowed them to be named variables - meaningful names that is, not numbers.

In the screen capture you can see that, for this mission, I have a trigger (list on the right) that ‘injects’ (force a reference to a sound file for later use in a task) sound files. In the DCS ME this flag was called ‘999’. 999 means nadda to me when rummaging through the mission in the ME. Here I’ve called it, what else, “InjectSounds”.

The “CheckOnCCC” and “CheckOffCCC” (you can name them whatever you want of course) are aliases to ‘94’ and ‘95’. Hopefully this demonstrates that the former is more meaningful than the latter. This example is just two flags used to check on/off the AWACs (CCC) freq so “Overloard” won’t call me when I’m off freq refueling and such.

At some point these little ‘micro’ operations can be created with a simple mouse click. But that’s a ways off.

And note this app is NOT a mission generator. Think of it more like a debugger and ‘Story Boarder’. The Story Board thingy should allow you to quickly ‘run’ the mission (via the Timeline slider) seeing when flags change state and triggers fire. It will never be an exact ‘rendition’ of a mission as, a) I can’t repro, say, a flight exactly, and b) the user is free to do whatever they want, thereby changing everything. The ability though the ‘manually’ fire a flag, thereby seeing what happens after that, might help.

The UI is just whatever first popped into my head (colors, layout, etc). Still to come is how best to display relationships. It’s been decades since I did any of this and things are a wee bit different. But it’s giving me headaches so that a good thing - means I’m finally using my brain again :grin:

And yes, I will be looking for volunteers when the time comes :slight_smile:

And I welcome any thoughts on features and layout.

4 Likes

I got the reference but checked the link to be sure - “to understand intuitively or by empathy, to establish rapport with” - LOL - yes, ver aptly named! :slightly_smiling_face:

EDIT:

I get it! :bulb:

Similar to FSXME although that was/is a building tool. Still, a graphical representation, color coded for objects, triggers, actions, waypoints, etc. Yes, a tool like you are building would be very helpful in, as you say, “Story Boarding” and debugging!

Grok indeed!

1 Like

New Question:

There has got to be an easy script to determine if a player or an AI aircraft has “Gone Winchester” - shot all of a specific type of missile.

I stated by looking at @Franze’s BINGO script from above:

I looked to replace the getFuel call with the same for ammo - there is a getAmmo but it is very different from getFuel.

That said, I think it might work since it contains

“a count variable defining “how much” is on board.”

…but I have no idea how to get to that variable.

Any thoughts?

EDIT: Plus I suspect it will also include gun ammo…

…another way of doing it would be to count AAM shots (in my case AIM-9M).

Again a @Franze post gave me the idea - a script that detected ARM shots and told the AI SAM sites to turn off their radars as a countermeasure. I didn’t need the SAM stuff so I came up with this:

AAM_ShotCounter = {}
function AAM_ShotConter:onEvent(event)
	if event.id == world.event.S_EVENT_SHOT then
		local wpn = event.weapon
		local wpnType = wpn:getTypeName()
		if wpnType == “AIM-9M” then
			return true
		end
	end
end
world.addEventHandler(AAM_ShotCounter)

However, it doesn’t seem to work as the condition for a Lua Predicate trigger…I tried various ways to enter the missile name based on what I saw in the missile database lua script i.e., AIM_9, weapons.missiles.AIM_9 …Hmmmm…

Oh boy, welcome to the wonderful world of weapon detection scripting! All done in arrays/tables/whatever!

To use getAmmo you have to run through iterations of arrays as each weapon is its own array with its own set of data (like ammo and quantity). Why they did it this way, I dunno; but it means you get a whole lot of data for a relatively simple query. It’s more or less overkill for what you want to do. If you know what the flight you’re trying to track starts with and what you want them to go home with, then you just add the launch numbers to a counter value and then track the counter value.

For the event, you run it once at mission start and that’s it. Nothing further is needed and anytime the event fires, it’ll run the script.

my_wepfiredcount = 0
function myfiredeh:onEvent(event)
if event.id == world.event.S_EVENT_SHOT then
	local unitid = event.initiator
	local gid = Unit.getGroup(unitid)
	local gname = gid:getName()
	if(gname == "myaigroup") then
		local wpn = event.weapon
		local wpntype = wpn:getTypeName()
		if(wpntype == "AIM-9M") then
			my_wepfiredcount = my_wepfiredcount + 1
		end
	end
end
end
world.addEventHandler(myfiredeh)

In this way, you only track “myaigroup” and see if my_wepfiredcount is equal to or greater than what your considered winchester setting should be for the group. You can also set this individually, but doing so you’ll have to make an array and track a fired counter for the entirety of the array and for each unit.

4 Likes

Thanks!
I was trying to jam it into a Lua Predicate trigger condition but I see now, that will not work.
:thinking:

Next question: Could another missile be added with an OR Boolean?

	if(gname == "myaigroup") then
		local wpn = event.weapon
		local wpntype = wpn:getTypeName()
		if(wpntype == "AIM-9M" or wpntype == "AIM-120B”) then
			my_wepfiredcount = my_wepfiredcount + 1
		end
	end

…then for a load of 4 x AIM-120B and 2 x AIM-9M, you would set it so that my_wepfiredcount > 5 causes the Winchester call?

If so, that will solve the whole issue - I’ll know what all the Fighters in a mission are carrying to begin with so I can set the my_wepfiredcount accordingly. Assume my 1st group of 2 x FA-18s are carrying 2 x AIM-9 & 4 x AIM-120B. Then set it so when my_wepfiredcount > 10 (i.e. one of them is completely out so the flight should egress while the other still has something to defend them with) a “Fight 1 is Winchester” call is made and a flag trips to send them home.

I’m going to try this based on @Franze’s code…

my_wepfiredcount = 0
function myfiredeh:onEvent(event)
if event.id == world.event.S_EVENT_SHOT then
	local unitid = event.initiator
	local gid = Unit.getGroup(unitid)
	local gname = gid:getName()
	if(gname == "myaigroup") then
		local wpn = event.weapon
		local wpntype = wpn:getTypeName()
		if(wpntype == "AIM-9M") then
			my_wepfiredcount = my_wepfiredcount + 1
                        trigger.action.outText("FOX 2", 10, false)
                              If my_wepfiredcount = 4 then
                                   trigger.action.outText("Winchester Sidewinders", 10, false)
                                   trigger.action.setUserFlag(“9”, 1) -- Flag 9 will trip a Go to WP trigger sending the aircraft home
                             end
		  end
	end
end
end
world.addEventHandler(myfiredeh)

…think I have the right amount of “end” …we shall see. :slightly_smiling_face:

Yes. If you have multiple types you’re trying to track, then you’re going to want to put things into an array. Bear in mind for the whole winchester thing, you can’t send individual units to RTB once out of ammo; only at the group level. Though the AI themselves are usually pretty good about RTBing once they’ve exhausted their useful load (barring the fight shifting to a defensive one with guns).

As always, you have singled out the crux of the issue

The mission I worked on: 3 Waves of TU-22M; wave 1 and 2 are 4 x Backfire flights attacking an airfield infrastructure; last wave a 2 ship hitting the runway. Set so they could pop chaff/flares and jam but not take evasive maneuvers / abort.

Defending: 2 flights of 4 x F-16s each carrying 4 AMRAM and 2 AIM-9X, a 2 ship in reserve (2 x AMRAM and 4 x AIM-9M; I could call it in using an F10 radio call). All groups were set to FTB when Winchester AAMs or Bingo. E-3A airborne providing a nice Link picture to coordinate shots with my flight - use TWS to get a few AMRAM in the air at once…worked pretty good for the first wave.

The second F-16 flight would not RTB until they were all Winchester…so a few always ended up dueling with the Tu-22M’s tail gun. Bad for their health and Not what I wanted. Tried keep count on my flight’s shots by remembering the FOX calls but that didn’t work so well in the middle of an engagement.

So my thought was some way of sending Flight 2 home before they are totally out of missiles - call it 2 - 3 left for a flight of 4; not perfect but close enough. Flight 2 calls Winchester and heads back, I can call in the reserves.

EDIT: I got it!!!

I was looking up the setUserFlag action and ran across this thread on the ED forum:

Handler = {}
function Handler:onEvent(event)
if event.id == world.event.S_EVENT_SHOT and event.initiator == Unit.getByName('UZI 11') or Unit.getByName('UZI 12') or Unit.getByName('UZI 13') or Unit.getByName('UZI 14') then
flag_value = trigger.misc.getUserFlag('10')
trigger.action.setUserFlag('10', flag_value + 1)
trigger.action.outText('Fox!', 3)
end
end
world.addEventHandler(Handler)

by “Sedlo”

It is a bit off on

event.initiator == Unit.getByName('UZI 11')…

but somebody provides a correction a bit farther down…so I can actually work this for several aircraft - and have the Winchester calls by Unit .

Add in some of @Franze’s code for identifying the missile and we’ve got a nice script. I like how it just does the counting and allows the determination of what constitutes Winchester inside the ME triggers.

Thanks to @Franze for taking me one more mile along the path od CS scripting knowledge!

I should’ve remembered this one from before, but there’s also an option to set a flight to RTB on out of ammo:

https://wiki.hoggitworld.com/view/DCS_option_rtbOnOutOfAmmo

Using this, you can set an entire group to bug out when they’ve used up any of the selected weapons.

1 Like

That is much simpler. I can probably set something to give a Winchester call when this triggers - All GROUP in a zone back towards base or something. Plus I like the ability to easily set the general type of missile - not have to spell it out for each one - AIM-9X and AIM-9M all in one category - easy. Thanks again!

So yesterday I had no idea how to go about this and now we have three different approaches! Lua may be frustrating at times but seems flexible in the long run.