Ah, I had that problem, too: unsichtbarer "Zugspeicher" für Flugzeuge
You can't change the params from the template afterwards, only the main params.
Hint: the modparams are also written in the stdout, there you can check
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
Ah, I had that problem, too: unsichtbarer "Zugspeicher" für Flugzeuge
You can't change the params from the template afterwards, only the main params.
Hint: the modparams are also written in the stdout, there you can check
So make sure, you are using unique keys.
I have changed each key name in both mod and .script files, but the game is using the wrong script file.
Please keep in mind, that both mods works when loading them separately.
Here is my description on how I can repeat the problem:
The first mod is now named with a big A at the end, the second mod has names with C at the end of each key name.
What I can see is that the game should open the file creek_bridge_streetA.script but it opens creek_bridge_streetC.script in the other loaded mod folder.
Is this a bug in the game and how can I do a work around?
Here are the two mods in the file explorer:
here is a snippet from the mod.lua in the eraA mod:
local street_fileA = "creek_bridge_streetA"
..
..
..
tempA.data = streetDynA
streetConA.constructionTemplates[1] = tempA
streetConA.categories = { "misc" }
streetConA.order = 100
streetConA.skipCollision = true
streetConA.updateScript.fileName = "construction/"..street_fileA..".updateFn"
streetConA.updateScript.params = {
paramPathA = setparPath,
paramIconsA = setparIcons,
streetwidthA = setparstreetwidth,
Abn_PathA = AbnPath,
HasPipeA = haspipeMod,
}
Alles anzeigen
a snippet from the mod.lua in the eraC directory
local street_fileC = "creek_bridge_streetC"
..
..
..
tempC.data = streetDynC
streetConC.constructionTemplates[1] = tempC
streetConC.categories = { "misc" }
streetConC.order = 101
streetConC.skipCollision = true
-- streetConC.autoRemovable = false
streetConC.updateScript.fileName = "construction/"..street_fileC..".updateFn"
streetConC.updateScript.params = {
paramPathC = setparPath,
paramIconsC = setparIcons,
streetwidthC = setparstreetwidth,
Abn_PathC = AbnPath,
HasPipeC = haspipeMod,
}
Alles anzeigen
I have changed each key name in both mod and .script files
Just to be sure, what I meant is the "key" of params: https://www.transportfever2.co…tructionbasics#parameters
local variables are not a problem, because they are only local
I would need more code to find the problem.
https://www.transportfever2.co…ding:modularconstructions
About Templates:
"type
can either be “DYNAMIC”
to return content in dependency of some parameters or “STATIC”
to do not offer parameters." (These are the two types in the exe)
The script binding will be saved in the construction entity, module slot configuration will be cached. Only when oldparameters != newparameters, the updateFn result will be used, Switching back to previous settings may use outdated cached results. You can remove or add an module to overwrite the cache and use the updateFn result...
Since TPF there is a problem, that ui parameters you define aren't present or have values of old user settings and may be outside of your parameter range (That is how TPF knows you last build track type or other settings across constructions)
The updateScript and module parameters are hold in params.constrParams.modules[slotId] and are replayed via game.config.ConstructWithModules in base_config.lua
Only a construction upgradeFn function has write access to these. But there you won't have access to modulenames -> script files mapping data. You have to provide these data in the dynamic module metadata yourself. Then it's technical currently even possible to call into a dynamic module script functions with your own name.
So I wrote a new build system with dynamic slotdata and connectors, so you can attach new modules to existing modules at connector points. (selectable by m/n). However my vector fu is somehow broken, I can't line up the tangents correctly and calculate the new module center and rotation correctly. Disabling collision checks when removing modules is a different problem I can't find a solution.
Conclusion: A build dynamic module will still use the scriptFilename at build time, regardless of changes you do. Parameters at least in my tests with the code are constant too.
VacuumTube and eis_os
Thank you for the update
So I wrote a new build system with dynamic slotdata and connectors, so you can attach new modules to existing modules at connector points.
Is it possible for you to send this example or can i download it somewhere?
I would need more code to find the problem.
I will first create the UI icons and do some new tests.
I am sorry, currently I can't share code. As soon as I have a functional version, I will release a new modular station called flexstation including a module creation guide.
It's fundamental different to the current system. Instead of using different slot types, there is currently only one 1x1m connection point type and the new module get created at upgradeFn time.
So the old modular data get reused for every run instead of creating a complete new station each time.
It uses corner cases of UGs script system I have to check if they still work in the next game release or get in contact with UG about that.
So still need to write a ton of new code, like connecting tracks with platforms as stations and platforms together.
I'm testing my mods in a game and now I have seen that yearFrom and yearTo doesn't work as I think they should. The mod is already enabled in year 1880.
I can't see that my code differs from the example in the WIKI.
local tempA = api.type.ConstructionTemplate.new()
tempA.availability = api.type.MetadataMap.Availability.new()
tempA.availability.yearFrom = 1890
tempA.availability.yearTo = 1929
tempA.desc.name = streetConA.description.name
tempA.desc.description = streetConA.description.description
local streetDynA = api.type.DynamicConstructionTemplate.new()
link to the example in WIKI: Reference (transportfever2.com)
Maybe you have a other mod that changes the yearFrom to all available?
No there are only my mods loaded in a new free game + (UG sandbox mod)
You would need to post the whole code, tempA in your code part isn't used...