Modifications are a convenient way to handle variations of vehicles without creating a separate XML for each variation. They allow you to change certain properties of your vehicle and use them as a derivative of the base vehicle.
Lets take the example vehicle from the previous part and create a modification that features the wing. We'll start by removing the .CGF from the base vehicle by leaving the "filename" and "filenameDestroyed" properties empty in the "wing_attachement" part.
<Part name="wing_attachement" class="AnimatedJoint" mass="0">
<AnimatedJoint filename="" filenameDestroyed="" id="idWing_attachement"/>
</Part>
We'll need to add an "id" property with a unique name, to reference this line in the <modification> group later on.
If you drop this vehicle into a level now, it won't feature the wing anymore, but it's got the part ready so that we can use it in our modification.
<Modifications>
<Modification name="rear_wing">
<Elems>
<Elem idRef="idWing_attachement" name="filename" value="objects/vehicles/default_vehicles/rear_wing.cgf"/>
<Elem idRef="idWing_attachement" name="filenameDestroyed" value="objects/vehicles/default_vehicles/rear_wing_damaged.cgf"/>
</Elems>
</Modification>
</Modifications>
I present to you, the modifications group. Any line that features an "id" property can be changed in here to create a modification of your vehicle.
For this example I created the "rear_wing" modification.
Let's take a closer look at one of the really important lines:
<Elem idRef="idWing_attachement" name="filename" value="objects/vehicles/default_vehicles/rear_wing.cgf"/>
Each property change needs to be defined in a line like this.
The value of the "idRef" property is the unique id of the line you want to change.
"name" refers to the property you want to change.
The "value" will replace what was previously defined for that property.
To switch to a modification of a vehicle in the editor, you need to enter the name of the modification in the vehicles properties and reload the vehicle.