Howto:Adding gun effects: Difference between revisions

Jump to navigation Jump to search
Line 131: Line 131:
         </mod-up>
         </mod-up>
       </key>
       </key>
==Sample joystick code ==
This sample code that can be modified/inserted into a joystick XML file uses one button to trigger the main armament and another button to trigger the secondary armament:
  <button n="0">
    <name>trigger</name>
    <desc>Trigger</desc>
    <binding>
      <command>nasal</command>
      <script>
        setprop("/controls/armament/trigger", 1);  #this seems the most common
setprop("ai/submodels/trigger", 1);        #many planes use this instead     
      </script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
      <script>
        setprop("/controls/armament/trigger", 0);  #this seems the most common
setprop("ai/submodels/trigger", 0);        #many planes use this instead     
      </script>
      </binding>
    </mod-up>
  </button>
  <button n="1">
    <name>trigger</name>
    <desc>Trigger</desc>
    <binding>
      <command>nasal</command>
      <script>
        setprop("/controls/armament/trigger1", 1);  #this seems the most common
      </script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
      <script>
        setprop("/controls/armament/trigger1", 0);  #this seems the most common
      </script>
      </binding>
    </mod-up>
  </button>
482

edits

Navigation menu