Creating custom file lists and sub-mods for the dummy mod

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


Sie betrachten gerade eine ältere Version des Eintrags. Klicken Sie hier, um zur aktuellen Version zu gelangen.

  • The dummy mod was designed to support custom file lists and sub-mods. This article will show how to do that.

    1 File lists

    If you encounter an error message, indicating that the game cannot find a certain file and there is no sub-mod available for this file, the easiest way to get your savegame working, is a custom file list. This list has to be stored in text-file named [tt]userList.lua[/tt], either directly in the main folder of the mod (where the mod.lua is located) or in the subfolder [tt]res/scripts[/tt] (it possible to use different files in both locations if you like). The content of the file should look like this: [code='userList.lua']local modelList = { { fileName = "res/models/model/vehicle/train/br_120_0.mdl", dummyModel = {name = "trainEngine", length = 19.2, seats = 0} }, } return modelList[/code] You should only change the lines 1 and 6-7 if you know what they do. The block from lines 2-5 can be used multiple times (one for each file you want to create, all of them before line 6 and 7). [b][u]Line 3[/u][/b] defines the name of the missing file. You can find it in the error message: [box]File: [color=#FF0000]res/models/model/vehicle/train/br_120_0.mdl[/color] cannot open [color=#FF0000]res/models/model/vehicle/train/br_120_0.mdl[/color]: No such file or directory This error is usually caused by modding. The Syntax of some game resources is not correct.[/box] or, after the game has been closed, at the end of the stdout.txt: [box][font='Consolas,Courier New,Courier,monospace']error in file [color=#FF0000]res/models/model/vehicle/train/br_120_0.mdl[/color]: cannot open [color=#FF0000]res/models/model/vehicle/train/br_120_0.mdl[/color]: No such file or directory[/font][/box] You'll have to make sure that the folder where the file is stored already exists in the mod. Unfortunately it's not possible to create folders with a Lua script. In this example the mod should have a subfolder [tt]res[/tt] with another subfolder [tt]models[/tt] and so on, to the folder [tt]train[/tt] (these specific folders are already present in the mod, but for more "exotic" objects, some folders may be missing). [b][u]Line 4[/u][/b] supplies some informations about the type of the missing file. Unfortunately there is no easy way to find them (since the file where you could find them no longer exists), but they are necessary in order to make the object work properly. [tt]name[/tt] decides which object to use for the file, the following values are valid (all other values will be ignored): [table] [tr] [td]trainEngine[/td] [td]Train Engine (also EMUs and DMUs)[/td] [/tr] [tr] [td]trainWagonPerson[/td] [td]Passenger wagons[/td] [/tr] [tr] [td]trainWagonCargo[/td] [td]Freight wagons[/td] [/tr] [tr] [td]tram[/td] [td]Trams[/td] [/tr] [tr] [td]tramCargo[/td] [td]Crargotrams[/td] [/tr] [tr] [td]bus[/td] [td]Busses[/td] [/tr] [tr] [td]truck[/td] [td]Trucks[/td] [/tr] [tr] [td]ship[/td] [td]Passenger ships[/td] [/tr] [tr] [td]shipCargo[/td] [td]Cargo ships[/td] [/tr] [tr] [td]person[/td] [td]Persons[/td] [/tr] [tr] [td]car[/td] [td]AI Cars[/td] [/tr] [tr] [td]misc[/td] [td]All other models (signals, depots, assets, etc.)[/td] [/tr] [tr] [td]construction[/td] [td]Constructions[/td] [/tr] [/table] [tt]length[/tt] defines the length of the model. This entry is optional and only relevant for trains, because train models that are to short or to long can also cause crashes. Therefore I recommend using values that are as accurate as possible. I'm aware that this might be difficult, if the object was modelled after a real vehicle, you could use its length. You can use [tt]seats[/tt] to define the amount of seats for crew and passengers. This entry is optional too and should only be used, if you know the exact amount or if the standard value is to low. In case you need neither [tt]length[/tt] nor [tt]seats[/tt], the line can be simplified to [tt]dummyModel = ""[/tt] (e.g. [tt]dummyModel = "bus"[/tt] or [tt]dummyModel = "shipCargo"[/tt]). If the error message persists after you saved the file and added the mod to your savegame, check if the [tt]userList.lua[/tt] is located in the correct folder and all folders for the missing files exist.

    2 Sub-mods

    You're having a backup of a deleted mod and are searching for a legal way to provide others with the necessary files, so they can still use their savegames? A custom sub-mod might be the solution. The sub-mod follows the same rules as any other mod, therefore you will need a folder named like [tt]_1[/tt] ( may contain additional underscores). You could use the names of the existing sub-mods as a template: [tt]dummies__1[/tt] or use something completely different. Inside this folder you have to create a file named [tt]mod.lua[/tt] and the folders for all files to be created. The content of the mod.lua should look like this: [code='mod.lua']local modelList = { { fileName = "", possiblePaths = { "mods//", "../../workshop/content/446800//" }, dummyModel = {name = "misc", length = 0, seats = 0}, }, } local info = debug.getinfo(1,'S') local modPath = string.sub(info.source, 2, string.len(info.source)-7) function data() return { info = {}, runFn = function (settings) if dummyModels then dummyModels.util.createModels(modPath, modelList) else print("Could not create dummy models. It seems the main mod is missing or not loaded at this point.") end end } end[/code] The block from line 2 to 9 has to be repeated for each file. [tt]fileName[/tt] and [tt]dummyModel[/tt] work the same way as in the custom file lists. The only new part is [tt]possiblePaths[/tt], where all file paths, where the file might be stored, are listed. They are used so that the dummy mod knows where to look for these files, in order to decide if they have to be created or not. Line 5 shows an example for a mod from the mod folder, line 6 for a mod from the workshop. Of course you don't necessarily need these two paths, you can also use more ore less. The entry in line 15 contains basically the same informations as the info.lua from Train Fever. If you want to learn more about it, i suggest reading this article: [url='https://www.transportfever.net/lexikon/index.php/Entry/92-Making-mods-work-with-the-in-game-mod-manager/']Making mods work with the in-game mod manager[/url] If you want to share your own sub-mod, you can do that under these conditions: [spoiler] [list][*]You're not allowed to share the main mod with your sub-mod. Link to the [url='https://www.transportfever.net/filebase/index.php/Entry/2734-Dummy-Modelle-Dummy-Models/']webdisk[/url] or the [url='http://steamcommunity.com/sharedfiles/filedetails/?id=864541399']steam workshop file[/url] instead [*]The sub-mod has to be uploaded at least on transportfever.net, an additional steam workshop release is possible [*]If you can't comply with these rules for some reason, contact me or @mediziner. [/list][/spoiler]

Teilen