FORUM THREAD FOR DISCUSSIONS HERE
I'm sure a lot of you modders have asked yourself how to get your (or your favorite) mod working from the get go.
I politely asked for guidance, and got some info on it.
Your mod need its own folder. The folder needs to be named like this: yourmodidentifier_majorVersionNumber
In this folder it's the same hierarchy as before, with a res folder, config (needed for multiple units), models, textures and so on.
Example
The mod identifier must be unique among all mods but can basically be anything that is as valid directory name. When choosing a mod identifier, keep in mind that this is also the folder name when the mod has been installed. Using a GUID will guarantee uniqueness but will be very hard to identify in the mod folder.
cfc0ff51-fe03-42b9-b831-68d189acebd1_1
When selecting a mod identifier it is good praxis to use an identifier that makes it easy to spot the mod.
nsb_stadlerflirt_mod_1
Keep in mind that this is an identifier for the mod and shouldn't be changed. This identifier may be used to check for updates etc.
When TFGM and TFMM converts older mods to the new system, they use the following algorithm to generate a mod identifier.
1. Concatenate author _ mod name _ major version
2. Convert to lowercase.
3. remove all characters that isn't a 0..9 and a..z
olahaldor_nsbstadlerflirt_1
If you make a major version of your mod, and it's become version 2.1, you should name the folder like this
olahaldor_nsbstadlerflirt_2
Preview image
To make the user experience better you should make a screenshot of your mod, so it's easier to see what mod the user is about to activate. This screenshot must be 320x180 pixels, and saved as uncompressed TARGA (.tga) and be named image_00.tga
If you have more than one image they are just named image_01.tga image_02.tga etc... For the time being TF only use the image_00.tga
This image file(s) needs to be placed in the root of your mod folder. So it'll be something like this
Documents
Documentation such as manuals or screenshots should be placed in the documents folder. This folder is optional and can be excluded if you have no additional files to include.
Mod configurations
If your mod use a configuration file, this file should be placed in the config folder located in the mod root. This folder is optional and can be excluded if you don't have a mod configuration.
olahaldor_nsbstadlerflirt_1
|-- res
|-- documents (optional)
|-- config (optional)
| |-- config.lua (optional)
|
|-- image_00.tga
Mod translation
All strings within _(...) are looked up in the strings.lua file. If no strings.lua is found or the string isn't defined inside it, the original string is used. Therefore it is recommended to write this string in English so as many users as possible can understand it if their own language isn't included.
olahaldor_nsbstadlerflirt_1
|-- res
|-- documents (optional)
|-- config (optional)
| |-- config.lua (optional)
|
|-- image_00.tga
|-- info.lua
|-- strings.lua (optional but highly recommended)
Getting the mod to show up in the menus
In order to get the mod to appear in the list of possible mods to activate, you will need another file, info.lua. The file will be placed in the root folder of your mod.
Any unused variables can be removed completely.
olahaldor_nsbstadlerflirt_1
|-- res
|-- documents (optional)
|-- config (optional)
| |-- config.lua (optional)
|
|-- image_00.tga
|-- info.lua
Here's an example of what the info.lua file looks like in my NSB Stadler Flirt mod.
function data() return {
minorVersion = 61, -- Minor version, count up from 0
severityAdd = "WARNING", -- OPTIONAL "NONE", "WARNING" or "CRITICAL"
severityRemove = "CRITICAL", -- OPTIONAL "NONE", "WARNING" or "CRITICAL"
name = "NSB Stadler Flirt", -- OPTIONAL mod name
description = _("NSB Stadler Flirt"), -- OPTIONAL description (with translations)
authors = { -- OPTIONAL one or multiple authors
{ name = "Ola Haldor Voll", -- author name
role = "CREATOR", -- OPTIONAL "CREATOR", "CO_CREATOR", "TESTER" or "BASED_ON" or "OTHER"
text = _("I made this"), -- OPTIONAL contribution description (with translations)
steamProfile = "76561197961659177", -- OPTIONAL steam profile ID number
tfnetId = 18378 -- OPTIONAL train-fever-net author id
}
},
tags = { "vehicle", "train" }, -- OPTIONAL "vehicle", "bus", "tram", "train", "steam", "diesel", "electric",
-- "railcar", "wagon", "passenger", "goods", "building", "station",
-- "deco", "town", "depot", "signal", "tool", "pack" or similar tags
tfnetId = 0, -- OPTIONAL train-fever.net download id
minGameVersion = 6219, -- OPTIONAL minimal required train fever game version
dependencies = { }, -- OPTIONAL list of dependent mod ids
url = "http://www.train-fever.net/filebase/index.php/Entry/74-NSB-Stadler-Flirt" -- OPTIONAL mod url
} end
Display More
Not all of the variables are used or even set in stone yet.
Train Fever only use the following variables.
minorVersion
This is the fraction part of the mod's version number.
A new version that doesn't break saved games should increase the minor version because it will replace the previous mod with the same major version.
This variable is mandatory and must be included.
Example 1:
Your mod is v2.3 and you decide to do a minor update that won't break game saves. The major version, the number at the end of your mod folder, stays the same; 2
The minorVersion number is incremented to 4 resulting in mod version 2.4
Example 2:
Your mod is v2.3 and you decide to do a major update that will break game saves. The major version, the number at the end of your mod folder, increments to 3
The minorVersion number is reset to 0 resulting in mod version 3.0
This will allow several versions of the same mod to co-exists so game saves prior to the major changes still can load (using the older version).
severityAdd
This tells Train Fever the impact of adding this mod to a saved game. There are currently 3 levels.
The variable is optional and can be excluded.
"NONE"
This mod can be added without any side effects.
"WARNING"
There may side effects but the game shouldn't crash.
"CRITICAL"
There is a high risk that the saved game will crash or be unplayable.
severityRemove
This tells Train Fever the impact of removing this mod from a saved game. There are currently 3 levels.
The variable is optional and can be excluded.
"NONE"
This mod can be removed without any side effects.
"WARNING"
There may side effects but the game shouldn't crash if removed.
"CRITICAL"
There is a high risk that the saved game will crash or be unplayable if removed.
name
The name of the mod, not to be confused with the mod identifier. The name is what you see in Train Fever's internal mod manager, TFGM and TFMM.
The name can be localized with the strings.lua translation file.
The variable is optional and can be excluded.
description
The mod's description. This is shown in Train Fever's internal mod manager, TFGM and TFMM.
The name can be localized with the strings.lua translation file.
The variable is optional and can be excluded.
minGameVersion
This is the minimum Train Fever version this mod requires to run. In practice, set this to the Train Fever version you tested the mod against.
The variable is optional and can be excluded.
Variables used by TFGM
These additional variables are used by TFGM to extend the mod information.
tags
This is a table with tags so the mod can be categorized/grouped/sorted etc.
The tag name itself serves as the tag identifier and should therefore be in English, preferable one word.
Example:
tags = { "station", "building", "passenger", "MyTag" }
TFGM have the capability to localize tags so you can search for a tag in any of the localized tag versions and still find it. A list of built in tag definitions are shown in gray while user defined tags are shown in white to indicate that the tag likely don't have localization.
There is no need to put the authors or mod name as a tag, these are included automatically in TFGM searches.
Built in tag definitions in TFGM.
Age | Vehicle ageing |
Building | Generic building |
Bus | A bus model for passenger transport |
Cost | Details concerning costs |
Decoration | Decoration model without any practical use |
Depot | Depot model |
Diesel | Diesel Engine |
Electric | Electric engine |
Engine | Engine as in train engine |
Goods | Goods components |
HUD | Head UP Display elements in the 3D view, icons for trains, stops, trucks, depots etc. |
Industry | Industry chains |
Maintenance | Details concerning maintenance |
Music | Background music in game and menus |
Name | In game name related |
Package | A package is an archived mod with several mods/changes |
Passenger | Passenger related |
Price | Alteration of prices |
Railcar | A rail carriage in general |
Script | A file containing Lua code |
Signal | A signal model for controlling traffic |
Sound | A sound effect such as engine sounds, door sounds, click sounds etc. |
Station | Station model |
Steam | Steam Engine |
Street | Street or road related |
Texture | A texture for a 3D model |
Time | Alteration of timeline or ageing |
Tool | Tools and utilities for Train Fever |
Town | A town related in general |
Tram | Tram model |
Train | A train in general |
Truck | Truck model |
UI | User Interface elements such as menu buttons |
Vehicle | A vehicle in general |
Waggon | Waggon model |
authors
This is a table with one or more authors to the mod. An author can have a role indicating his contribution to the mod.
Example with 3 author:
authors = {
{ name = "Ola Haldor Voll",
role = "CREATOR",
steamProfile = "76561197961659177",
text = _("I made this!"),
tfnetId = 18378
},
{ name = "Gwinda",
role = "TRANSLATOR",
steamProfile = "76561198041807425",
text = "sv",
tfnetId = 18570
},
{ name = "Gurra Aktersnurra",
role = "BASED_ON",
text = "example mod",
steamProfile = "12345678901234567",
tfnetId = 12345
}
}
Display More
name
The name of the author, displayed on the author card and in list view.
steamProfile
This is the numerical Steam profile ID. You can retrieve it from TFGM's Preferences dialog.
The ID is used to fetch your Steam avatar image and link to your Steam Profile Page.
role
There are currently 4 roles.
"CREATOR"
This is a lead creator of the mod.
The text field have at this point no meaning and can be freely used. You can put it inside a _(...) for translation.
"CO_CREATOR"
This is a Co-Creator contributing to the mod.
The text variable specifies what he/she contributed with. You can put it inside a _(...) for translation.
"BASED_ON"
This mod was based on the work of this author.
The text variable specifies the mod(s) this mod was based on.
"TESTER"
This author did mod testing.
The text variable specifies what was tested. For example "Windows 7", "Linux", "Mac" etc...
"TRANSLATOR"
This creator contributed with a localization (translation) of the mod.
The text variable specifies what language he/she contributed with.
The language is specified with it's ISO639-1 language code (not to be confused with a country code).
text
This field has different meaning depending on the role, see each role for an explanation.
tfnetId
This might have been a typo and should probably be the tfnet_author_id found in tfmm.ini and should probably be named/renamed to tfnetAuthorId
This isn't at this point used by TFGM at all.
Other variables not used by Train Fever or TFGM (TFMM?)
These variables are not used by TFGM or Train Fever at the moment. I'm not even sure TFMM use them.
dependencies
A list of mods this mods depends on to run properly. I'm not sure if the latest TFMM uses it either.
url
A fully qualified URL to the mod's official home page. Not
The strings.lus would look something like this in English and Google translated to German and Swedish:
function data() return {
-- English
en = {
['NSB Stadler Flirt'] = 'NSB Stadler FLIRT (Fast Light Innovative Regional Train) is a diesel or electric multiple unit railcar'..
'produced by Stadler Rail AG. The articulated trainset comes in units of two to six cars with two to six'..
'motorized axles. The maximum speed is 200 km/h (120 mph). Standard floor height is 57 cm (22.4 in),'..
'but 78 cm (30.7 in) high floors are also available for platform heights of 76 cm (29.9 in).\n'..
'\n'..
'The FLIRT train was originally developed for the Swiss Federal Railways and was first delivered in 2004.'..
'The trains quickly became a success and were ordered by operators in Algeria, Azerbaijan, Belarus,'..
'the Czech Republic, Estonia, Finland, Germany, Hungary, Italy, Latvia, the Netherlands, Norway, Poland,'..
'Serbia, Sweden and Switzerland. As of February 2015, 1,094 units have been sold.',
['I made this' ] = 'I made this'
},
-- German
de = {
['NSB Stadler Flirt'] = 'NSB Stadler FLIRT (Flinker Leichter Innovativer Regional Triebzug) ist ein Diesel- oder Elektrotriebtriebwagen'..
'von Stadler Rail AG produziert. Der Sattelzug Set wird in Einheiten von zwei bis sechs Autos mit zwei bis'..
'sechs angetriebenen Achsen. Die Höchstgeschwindigkeit beträgt 200 km / h (120 mph). Standardhöhe ab Boden'..
'beträgt 57 cm (22,4 Zoll), aber 78cm (30.7 in) den oberen Etagen sind auch für Plattformhöhen von 76 cm'..
'(29,9 Zoll) erhältlich.\n'..
'\n'..
'Der FLIRT Zug wurde ursprünglich für den Schweizerischen Bundesbahnen entwickelt und wurde zum ersten Mal'..
'im Jahr 2004 ausgeliefert Die Züge wurde schnell ein Erfolg und wurden von den Betreibern in Algerien,'..
'Aserbaidschan, Belarus, der Tschechischen Republik, Estland, Finnland, Deutschland, Ungarn, Italien bestellt,'..
'Lettland, die Niederlande, Norwegen, Polen, Serbien, Schweden und der Schweiz. Ab Februar 2015 wurden 1.094'..
'Einheiten verkauft.\n',
['I made this' ] = 'Ich habe das gemacht'
},
-- Swedish
sv = {
['NSB Stadler Flirt'] = 'NSB Stadler FLIRT (Fast Light Innovative Regional Train) är en diesel- eller elektrisk multipelenhet rälsbuss'..
'som produceras av Stadler Rail AG. Den ledade tågsätt kommer i enheter om två till sex bilar med två till'..
'sex motoriserade axlar. Maxhastigheten är 200 km / t (120 mph). Standard golvhöjd är 57 cm (22,4 tum),'..
'men 78cm (30,7 tum) höga golv är också tillgängliga för plattformshöjder på 76 cm (29,9 tum).\n'..
'\n'..
'Den FLIRT Tåget utvecklades ursprungligen för den schweiziska federala järnvägar och första levererades under'..
'2004. Tågen blev snabbt en succé och har beställts av operatörer i Algeriet, Azerbajdzjan, Vitryssland, Tjeckien,'..
'Estland, Finland, Tyskland, Ungern, Italien, Lettland, Nederländerna, Norge, Polen, Serbien, Schweiz och Sverige.'..
'Från och med februari 2015, har 1,094 enheter sålts.',
['I made this' ] = 'Jag gjorde detta'
}
} end
Display More
In the end, here's what it will look like in the Train Fever mod activation. Notice how the major and minor version names appear next to the name tag from the info.lua file while the description appears below the preview image.
[Blocked Image: http://puu.sh/ggdaU/1662bcfb8e.jpg]
I hope this will get you going to update your mods!