How to Add Custom Specializations to modDesc.xml for Your Farming Simulator Mod

By Jason van Gumster, Christian Ammann

If you’ve written your own custom specialization in Lua for your Farming Simulator mod, you need to add an additional block of mark-up to your modDesc.xml. You basically need to make GIANTS Engine aware of your script. After you do that, you can treat your custom specialization just like any of the default ones that ship with Farming Simulator.

The additional mark-up that you need belongs within a specializations section. Most modders put the specializations open and close tags above the vehicleTypes tag in their modDesc.xml. The mark-up you want to add should look something like this:

<specializations>
 <specialization name="mySpecialization" className="MySpecialization" filename="scripts/MySpecialization.lua" />
</specializations>

The specialization tag in the specializations section has three attributes:

  • name: The custom name you give to your specialization. Anything else that uses this specialization of yours will need to reference this name.

  • className: Although this attribute is named the same as that in the type tag within the vehicleTypes section, its purpose is slightly different. It doesn’t refer to a vehicle class. It’s a class/object that you’ve defined in your specialization’s Lua file.

  • filename: This attribute should point to the folder that holds your Lua script defining this specialization. Most modders typically have a scripts folder within their mod where they place all of the scripts that are relevant to that mod.

After you add this block of mark-up to your modDesc.xml file, you can add your specialization within a type tag of the vehicleTypes section. The total block of mark-up to support your custom specialization would look something like this:

<specializations>
 <specialization name="mySpecialization" className="MySpecialization" filename="scripts/MySpecialization.lua" />
</specializations>
<vehicleTypes>
 <type name="myMod" className="Vehicle" filename=$dataS/scripts/vehicles/Vehicle.lua">
 <specialization name="mySpecialization" />
 </type>
</vehicleTypes>