Fixing missing specializations in a shortened modDesc

Game Version: Giant's Editor 4.1.7 upwards
Programs required: Winzip, Jzip, 7zip or WinRar | Notepad / Notepad++


Modding Index | Vehicle Tutorials


This Tutorial has been written for FS11 and may not apply to previous versions.
This Tutorial will show you basically step by step, how to custom edit a shortened modDesc.
This Tutorial does not and will not cover converting an FS09 mod to FS11.

Associated Documents:

[Tutorial] Making a mod from a default item -- Part 2. -- The modDesc
[Tutorial] Making a mod from a default item -- Part 3 -- making a custom modDesc
[Tutorial] Making a mod from a default item -- Part 4. -- adding specializations

Knowledge required:
able to make new folders using Windows Explorer (file manager)
able to unzip zip files to a specific place
able to edit xml files in Notepad++

This Tutorial can be used to add specializations to other mods using the same basic procedures and processes…

Very occasionally you will download a mod that has a shortened modDesc.xml file.

Here I have downloaded the John Deere 4730 self propelled sprayer and thought a ESLimiter script might be handy, but…

Upon opening the modDesc it looks incomplete as below; there are no lines where I can add any scripts – yet the mod works fine in-game, why is it so ?
Fig:1

From a previous tutorial we know: the modDesc.xml calls the XML file and any specialization lua files the XML file calls the i3d file

But this is missing all the specialization lines that are usually seen in a modDesc…

The secret is in the vehicle xml file.
Fig:2

Look at the 4730's xml file and if we look closely at lines 2 and 5 we find the secret…

Line 2 must always be present to tell the game what type of mod this is.

In this case this mod is using a default name: <vehicle type=“selfPropelledSprayer”>

Now what this does is it tells the game to treat this as a self propelled sprayer and use the built in scripts to define its functions.

and if we look at line 5 we see: <typeDesc>$l10n_TypeDesc_Sprayer</typeDesc> – this line uses:

the $ sign means tell the game to use something from the game folders in the game install folder the l10n means display text in the Help box (F1) the TypeDesc_Sprayer means use the default text in the F1 Help box from the default sprayer script

All these lua scripts are encoded in the dataS and dataS gar files in the install folder and you cannot access them - unlike FS09 apparently.

However, Giants have made these available if you want to modify and use them in custom mods - if you have or gain the knowledge of lua scripting…

We can add the missing specialization lines if we want, we do not need to for it to work as standard as we have seen.

But…

One vitally important difference between default items and mods, is; if you want to add mod scripts to a mod then you must edit the default script call lines to something else; in this case Lines 2 and 5.

If we don't and we add custom scripts, the default lines will the call default scripts and will over-ride the calling of custom scripts.

So:

In the xml file we see Line 2 calls this a selfPropelledSprayer

If we go to Making a Mod Part 2 and scroll down the where the specialization lines are, and look for selfPropelledSprayer:

We see the following:

<vehiclesTypes>
 <type name="selfPropelledSprayer" className="Vehicle" filename="$dataS/scripts/vehicles/Vehicle.lua">
     <specialization name="motorized" />
     <specialization name="steerable" />
     <specialization name="foldable" />
     <specialization name="fillable" />
     <specialization name="sprayer" />
     <specialization name="hirable" />
     <specialization name="aiTractor" />
     <specialization name="honk" />
 </type>
</vehiclesTypes>

Now we can copy and paste that straight into our modDesc in the appropriate place, which in my opinion is as below…
Fig:3

At this stage the 4730 will still react and behave exactly as a default sprayer perfectly ingame.

If we want to add custom scripts like the ESLimiter, Odometer or beleuchtung/additionalLights lua scripts, then we need to stop the mod from using default scripts.

We do this by giving it a custom name.

So, in the modDesc edit the specialization line 17 to something else descriptive of the mod - eg JD4730 as below:
Fig:4

Now we must do the same in the xml file in Line 2 - edit Line 2 to have the same name as in the vehicle line in the modDesc ie. JD4730

These two entries must match - the usual result if they don't, is that the mod shows up in the store, you try to buy it but it doesn't show ingame…

and the usual error in the log.txt file is: can't load mod unknown type

and delete the TypeDesc line all together

The specialization lines (and any custom script lines) we added to the modDesc will now control the text in the F1 Help Box as well as defining how the mod behaves. Fig:5

Now and only now can you start to add any custom scripts.


Original Author: sandgroper | Date: February 09, 2012

Modding Index | Vehicle Tutorials