Jump to content

Mini Tutorial: adding ON, else OFF switches to the Apache config


Recommended Posts

This just came up in another thread, and since I just added such a keybind yesterday, I thought I'd let you guys know how I did it.

What I wanted to do: Use a two-way-switch on the base of my TM Warthog throttle to switch the NVS on the left console to NORM when in the up position, and switch it to OFF when in the down position.

How I did it: Modify the input files for the Pilot and CPG cockpits, and then bind it in DCS' standard controller binding interface.

Here we go:

First, we're looking for the proper input file. It should be one of these:

-- Pilot:
C:\Program Files\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\AH-64D\Input\AH-64D_PLT\joystick\default.lua

-- CPG:
C:\Program Files\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\AH-64D\Input\AH-64D_CPG\joystick\default.lua

These files can be opened and edited with Notepad, but editors like Notepad++ (available for free) work a bit better and offer more comfort.

Make sure DCS is not running.

Open the default.lua input files in your preferred text editor. Next, locate the commands we're interested in. For the AH-64D, the commands are likely to be identical in both files, because the cockpits are almost identical in terms of keybinds.

I wanted to map the NVS NORM and OFF positions to a two-way switch on my Warthog base:

image.png

So, searching the above mentioned Lua files for "NVS" yields these results, among others:

------------------------------------------------
-- NVS Mode Panel ------------------------------
------------------------------------------------
{	down = electric_commands.NVS_MODE_KNOB_ITER,													cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  1.0,					name = _('PLT NVS MODE Switch - Up'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_ITER,													cockpit_device_id = devices.ELEC_INTERFACE,		value_down = -1.0,					name = _('PLT NVS MODE Switch - Down'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  1.0,					name = _('PLT NVS MODE Switch - FIXED'),			category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  0.0,					name = _('PLT NVS MODE Switch - NORM'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down = -1.0,					name = _('PLT NVS MODE Switch - OFF'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = hydraulic_commands.TailWheelUnLock_EXT,	up = hydraulic_commands.TailWheelUnLock_EXT,	cockpit_device_id = devices.HYDRO_INTERFACE,	value_down =  1.0,	value_up = 0.0,	name = _('TAIL WHEEL Pushbutton - LOCK/UNLOCK'),	category = {_('Left Console'), _('NVS Mode Panel')}},

Awesome, that sounds like exactly what I'm looking for.

The lines for NVS_MODE_KNOB_ITER are probably the "one step up" and "one step down" iterators, I don't care about those.

The three lines NVS_MODE_KNOB_EXT look great, because they're labeled "FIXED", "NORM" and "OFF". Exactly what I'm looking for. Personally, I'm not interested in the FIXED position, that leaves me with the two lines for NORM and OFF.

These switches only react to the down position, so "when the button is pressed on the controller". I want to add "when the button is released" to the mix, known as the "up" command.

Merging the two lines I care about into a single, new line with both the up and down commands looks like this:

---------------------------------------------
-- Controller Overrides ---------------------
---------------------------------------------
{ down = electric_commands.NVS_MODE_KNOB_EXT, up = electric_commands.NVS_MODE_KNOB_EXT, cockpit_device_id = devices.ELEC_INTERFACE, value_down = 0.0, value_up = -1.0, name = _('PLT NVS MODE Switch - NORM<>OFF'), category = {_('Left Console'), _('NVS Mode Panel')}},

And that's it. Personally, I add these blocks near the top of the file so I can easily see what I've added.

Save the default.lua for both cockpits (if applicable).

Now let's fire up DCS and assign the new keybind to the switch we want to map:

image.png

Works like a charm. 🙂

Final word of caution: during updates, DCS overwrites these files without asking you about it, so you need to re-apply this fix after every update. Best to make backups of the original files and of the modified ones, so you can just copy and paste your modifications when ED changes the default.lua.

Note, if there's a way to modify these files in Saved Games, that would be marvelous, but last I checked these modifications still had to go to the installation directory.

Note, as far as I'm aware this does not break the multiplayer integrity check, but do keep in mind that it's a modification to the game's base files.

Let me know if this was of any help to anyone. 🙂


Edited by Yurgon
  • Thanks 3
Link to comment
Share on other sites

A saved games .diff would be nice, in the meantime I use OVGME to reinstall the changes after updates.


Edited by Sarge55
  • Like 1

[sIGPIC][/sIGPIC]

i7 10700K OC 5.1GHZ / 500GB SSD & 1TB M:2 & 4TB HDD / MSI Gaming MB / GTX 1080 / 32GB RAM / Win 10 / TrackIR 4 Pro / CH Pedals / TM Warthog

Link to comment
Share on other sites

9 hours ago, Sarge55 said:

A saved games .diff would be nice, in the meantime I use OVGME to reinstall the changes after updates.

 

This.  But only thing that sucks is if they update some functionality/controls, then you have to manually add it back in to the new controls file, i.e. when the F16 got the ECM switches added in.  Doesn't take long, but just something to keep in mind seeing how this module was just released, it's likely to receive new binding updates in the future.

  • Like 2

5900x | 3090 | HP Reverb G2

Link to comment
Share on other sites

2 hours ago, Chaos_Out said:

This.  But only thing that sucks is if they update some functionality/controls, then you have to manually add it back in to the new controls file, i.e. when the F16 got the ECM switches added in.  Doesn't take long, but just something to keep in mind seeing how this module was just released, it's likely to receive new binding updates in the future.

this should help with that

https://github.com/Quaggles/dcs-input-command-injector

Link to comment
Share on other sites

  • 5 months later...

It's a bit of a late reply to the topic but I was looking for a way to use my on/off/on switch for the NVS modes and your post helped!

Still had to do some trial and error, but if anyone needs it:

{down=electric_commands.NVS_MODE_KNOB_EXT, up=electric_commands.NVS_MODE_KNOB_EXT, cockpit_device_id = devices.ELEC_INTERFACE, value_down = 1.0, value_up = 0.0, name = _('PLT NVS MODE Switch - FixedNorm'), category = {_('Left Console'), _('NVS Mode Panel')}},
{down=electric_commands.NVS_MODE_KNOB_EXT, up=electric_commands.NVS_MODE_KNOB_EXT, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = _('PLT NVS MODE Switch - NormOff'), category = {_('Left Console'), _('NVS Mode Panel')}},

"FixedNorm" is mapped to Button1, "NormOff" is mapped to Button2.

If I turn on button 1, it goes to fixed. If I turn off button 1, it goes to norm. If I turn on button 2 it goes to off. If I turn off button 2 it goes to norm. Just like in the sim.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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