Howto:Adding Bombable to FlightGear Aircraft: Difference between revisions

Jump to navigation Jump to search
Line 636: Line 636:


Bombable will work with any of those options--so it is really up to you.
Bombable will work with any of those options--so it is really up to you.
==EXTRA: Making livery change with damage==
Once you have Bombable working with your aircraft there is a bonus: bombable.nas will handle setting the livery colors and
automatically changing them as the object becomes damaged. 
For an example of how this works and looks, take a look at the Bombable scenarios involving the M1 tank and the Jeep.
For this to work your model must have different liveries available
and then animate the liveries so that the texture used is the one shown
in this path: /ai/model/model[X]/bombable/texture-corps-path.  The /ai/model/model[X]/ part is assumed for AI craft so you need to add <texture-prop>bombable/texture-corps-path</texture-prop> in the right place of your XML file.
Example from Jeep.xml in the jeep-bombable directory:
<animation>
  <type>material</type>
  <object-name>jeep-body</object-name>
  <object-name>roof1</object-name>
  <object-name>roof2</object-name>
  <object-name>softroof</object-name>
  <object-name>chassis</object-name>
  <object-name>chassis.002</object-name>
  <object-name>Plane</object-name>
  <object-name>hinge</object-name>
  <object-name>screen</object-name>
  <object-name>wiper.L</object-name>
  <object-name>wiper.R</object-name>
  <object-name>seat.L</object-name>
  <object-name>seat.R</object-name>
  <texture-prop>bombable/texture-corps-path</texture-prop>
  <transparency>
      <alpha>1.0</alpha>
  </transparency>
</animation>
 
Additionally, if you want to change your object's the livery color programmatically (for instance, if you include a menu item to select different liveries) you can use the following code in the -bombableinclude.xml file (see above) to change all liveries, including damage liveries, that the object uses:
Example:
    liveries = [
        "Models/livery_nodamage.png",
        "Models/livery_slightdamage.png",
        "Models/livery_highdamage.png");
    ];
    bombable.set_livery (cmdarg().getPath(), liveries);
You can include liveries for as many different levels of damage (ie, fine gradations of change from undamaged to completely damaged) as you like.  For instance:
Example:
    liveries = [
        "Models/livery_nodamage.png",
        "Models/livery_barelydamaged.png",
        "Models/livery_justslightlydamaged.png",
        "Models/livery_alittlemoredamage.png",
        "Models/livery_fairlydamaged.png",         
        "Models/livery_kindadamaged.png",
        "Models/livery_prettydamaged.png",
        "Models/livery_whoawereintroublenow.png",                 
        "Models/livery_finishedoff.png");
    ];
    bombable.set_livery (cmdarg().getPath(), liveries); 


==Related==
==Related==
482

edits

Navigation menu