Beiträge von EISFEUER
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
-
-
melectro You found a good part for the dynamic param puzzle. I don't have recongnized this script. Thanks for it
I've testet the marked lines of code. They are working fine in my context.
The problem is, that the whole code snipped doesn't make sence for me and will not help in your context.
Here are the comments you requested:```
Code: construction_postRunFn.lua from UG Api example
Alles anzeigen-- get own construction from the repository local con = api.res.constructionRep.get(api.res.constructionRep.find("myCon")) -- create param object with all typical properties (same as the difinition in the con) local par1 = api.type.ScriptParam.new() par1.key = "key_2" par1.name = "Key 2" par1.tooltip = "Key 2 (tooltip)" par1.values = {"1", "2", "3"} -- Creates general construction template local templ = api.type.ConstructionTemplate.new() -- Creates content for a dynamic template local dyn = api.type.DynamicConstructionTemplate.new() -- Assign param to template dyn.params[1] = par1 -- Name of the template templ.desc.name = _("My Construction") -- Assign dynamic template data to the template itself templ.data = dyn -- add template with one param to the construction con.constructionTemplates[1] = templ```
So far so good.
What not makes sence to me is. In the lines above they create an asset object. The construction templates are good for modular construction, but does not help in case of asset (except they are modular, but in this snippet there are no modules created for it). This param will appear in the createTemplateFn() where you define where all the module should be placed. If you have no module you will have `return {}` and the parameter have no impact. You will need this parameter in the updateFn().
I have tried to add a parameter to my existing params of my constructionTemplate. This does't change anytihing. Same with manipulating one of my params . No changes. When I clone my construction template, add a new parameter and override my old constructionTemplate it works.
EDIT: only for my own interest. What does a `preProcessFn`? (Was assigned to the asset in this code snipped) I never heard of it before.
EDIT: I've got the sulution.
Adding params are have no effects on the constructionTemplate only does have no effect. When I add params to the normal construction param list it works fine.Code
Alles anzeigen-- get bench asset from repository local bench = api.res.constructionRep.get(api.res.constructionRep.find('asset/default_multi_bench_new.con')) -- create a new param object local colorParam = api.type.ScriptParam.new() colorParam.key = "bench_color" colorParam.name = "Bench Color" colorParam.tooltip = "Choose you bench color" colorParam.values = {"red", "green", "blue"} -- add new param to the bottom of the param list bench.params[bench.params + 1] = colorParamHere is the evidence
-
-
Zur neuen Brücke: Die ist der Billhafenbrücke, die gerade von mir im Bau ist sehr ähnlich, kann ich die gleich mitmachen. Gleis und Straße auf einer wird es aber dann nur als Asset-Brücke geben, was bei dieser kein Problem sein sollte, weil sie sehr gerade aussieht.
Zur alten Brücke: Gerade bei alten Brücken, die viele Ornamente, Metallverzierung und so'n Zeug haben, brauche ich Bilder und Nahaufnahmen fast von jedem Winkel der Brücke, was bei einer, die nicht mehr existiert, schwierig ist. DH-106 hat zwar schon viel Material geliefert jedoch hab ich noch keinerlei Vorstellung wie der Bogen exakt aussieht. Beton und Steinbrücken sind was Materiallage angeht meist simpler. Schiene auf Straße ist optisch kein Problem (Straßenbahn), funktional ist es auch theoretisch möglich, nur sehr kompiziert und am Ende recht unflexibel und bei Asset-Brücken möglich.Eine alte Brücke hab ich noch vor zu Bauen, jedoch nicht diese. Die meisten Kandidaten sind aber in der Nähe von dieser.
-
These lines are the last three lines in the postRunFn() of MOTRAS 1.1 which is currently WIP. You will find the files here:
https://github.com/eisfeuer/tpf2-modular-train-station
but here an example in the nutshell.
I have two params ({cat = 'meow', dog = 'bow-wow'}) which I want to transfer from the mod.lua to my construction.
For this I need theese files:
construction/myCon.con: the construction file
construction/myCon.script: file, that contrains the function I want to manipulate (In this case the updateFn())
mode.lua: the mod settings file
First the updateFn in myCon.con
The PostRunFn needs following three linesCodepostRnFn = function (settings, params) -- gets the own construction from the repository local motrasStation = api.res.constructionRep.get(api.res.constructionRep.find('myCon.con')) -- overrides the updateFn() of the construction motrasStation.updateScript.fileName = "construction/myCon.updateFn" -- adds additional params to the updateFn() motrasStation.updateScript.params = {cat = 'meow', dog = 'bow-wow'} end
At last, the .script-FileCode
Alles anzeigenfunction data() return { updateFn = function(params) -- get Params from mod.lua local paramsFromModLua = self.params.capturedParams -- {cat = 'meow', dog = 'bow-wow' } local result = {} --- ... do all construction updateFn() stuff return result end, } endThat's it
-
There is a way to get stuff from the mod.lua to the con-script.
You have to outsource your createFn or updateFn to an .script-file (Look at the script-file of the track from UG to see closely how this file is structured).
You can include this script file with params using code similar to this (themes is my param transfered from mod.lua to con)Code: mod.lua (postRunFn)local motrasStation = api.res.constructionRep.get(api.res.constructionRep.find('station/rail/motras.con')) motrasStation.createTemplateScript.fileName = "construction/station/rail/motras.createTemplateFn" motrasStation.createTemplateScript.params = {themes = stylelist:get()}You have access to all your params using `params.capturedParams` in the .script-file
-
wird beim Exportieren die bones nicht mitgenommen
Beim FBX-Import beim Modeleditor von UG können Bones mit importiert werden. Sie werden dort auch angezeigt. Jedoch kann ich nicht sagen, wie gut sie Sims importieren lassen. Ich habe die Bone nur bei Brückenteilen verwendet.
-
Zu den Straßen: Es gibt Module für die Zugangsstraßen. Diese einfach kompieren und den Straßentyp in den ändern den du willst.
Zu den Tram-Masten: Am besten lassen.
Die Masten sind in gefühlt tausenden Modellen zusammen mit dem Gleisen und Lanes. Sind viele Teile, die wie bei einer Modelleisenbahn zusammengebaut werden.
Alle müssten dupliziert und geändert werden. Desweiteren braucht es noch ein Fake-Modul was die Models ändert. -
Nach langem Gebastel, hab ich es entlich hinbekommen, dass man auch sehen kann, was für ein Theme man auswählt (Ist das Feld 'Aussehen / Corporate Identity' auf dem Screenshot).
PeugeotRacer irgendwie habe ich deine Frage übersehen. Kleine Bushaltestellen lassen sich nicht modular beuen geschweige mit Parametern. Was irgendwann kommt ist, dass man die Wartehäuschen auf Bahnhöfen platzieren kann.
, -
Teile des Pakets, das sind die LCD-Anzeiger mit Uhr, Kameras, Lautsprecher und der Befestigung werden in das DB-Bahnsteigpaket mit integriert.
-
Hab den Post erst jetzt gesehen.
Eine halbe Lösung hab ich schon für das Problem. Ich habe es geschafft, Sachen aus dem Repo in die createTemplateFn() meiner .con zu bekommen (updateFn sollte genauso funktionieren).
Du kannst diese in eine .script-Datei auslagern und diese in der postRunFn() deiner Konstruktion zuweisen. (Den Aufbau der .script-Datei kannst du dir im Spiel bei den Gleismodulen anschauen, eigentlich selbsterklärend).
Scriptmäßig sieht es dann so ausCodelocal styleList = {'style1', 'style2'} -- Ist im meinem Script etwas komplexer .-) local motrasStation = api.res.constructionRep.get(api.res.constructionRep.find('station/rail/motras.con')) motrasStation.createTemplateScript.fileName = "construction/station/rail/motras.createTemplateFn" motrasStation.createTemplateScript.params = {themes = styleList}In der createTemplateFn oder updateFn kommst du so an den Parameter:
Was ich noch nicht rausgefunden habe, ist wie ich dann ein dynamische UI-Element hinkriege. Momentan hab ich eine Auswahl mit Mengen an Zahlen wo man Raten muss was man auswählen will.
-
Terminus station are planned, but will take some time
-
Hier eine weitere Idee, die ich gerade am umsetzen bin, aber momentan noch ganz an der Anfangsphase ist. Es handelt sich dabei um Themes. Themes sind ein Sammlung an Modulen, wie Bänke, Mülleimer, Zielanzeiger, Uhren, Bahnsteigs- / Infotageln etc. die die Identität eines Unternehmens wie z.B. die DB wiederspiegelt.
Themes können als eigene Mod erstellt werden und werden automatisch zu bestehenden Bahnhöfen (die Themes unterstützen) hinzugefügt. Durch Themes können Bahnhöfe unabhängig vom Betreiber gemacht werden und man so mit einem Klick ein DB-Bahnhof zum ÖBB-Bahnhof machen.
Hier mal ein Beispiel. Ich habe mein MOTRAS-Bahnhof, ein DB-Theme und ein ÖBB-Theme geladen (beide momentan in der Entwicklung). Auf dem Bilder habe ich eine Theme-Auswahl, die eine Uhr beeinflusst (wie gesagt befindet sich alles noch am Anfang)Ein Problem hab ich jedoch, ich kann zwar dynamisch Themen hinzufügen, jedoch weiß ich nicht wie ich die Theme-Auswahl dynamisch anpassen kann. Hat jemand damit schon erfahrung und weiß wie das geht?
-
Dann hast du selbst eine globale Variable hasBus definiert. (Der Fehler kommt nur wenn der debug-modus nicht an ist)
-
Wie ist denn `hasBus` definiert? Ich vermute das diese aus irgendein Grund `nil` ist.
Wozu das elseif ? Wenn nur das Gegenteil (in diesem Fall `not hasBus`) gecheckt wird, ist ein normales else besser (lesbarer und performanter).Codeif hasBus then right.lightModels = getLightModels(args, models, fromToR) right.poleModels = getPoleModels(args, models, fromToR, params.poleTrafficLight) else right.lightModels = getLightModels(args, bTR, fromToR) right.poleModels = getPoleModels(args, bTR, fromToR, params.poleTrafficLight) endWürde es auch eher so schreiben (weil das meiste gleich im if/else ist)
-
The file has to be end with '.module' and has to be in the 'construction' folder as it is in the game.
There will be no changes on the station itself. There should only be an additional module in the platform manu.
-
Gibt ein kleines Update beim Coradia A TER. reiste hat die französchischen Wagen verbesser, sowie die Mod auf französisch übersetzt.
Alstom Coradia A TER -
-
-
Die Maße wären 40x1.8m