Beiträge von WernerK

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


    Ja, das geht. Da es schon spät ist, erst mal nur ganz kurz ...


    Zwei Möglichkeiten:

    - Du könntest sidewalkWidth in der Straßendatei verändern. Relativ einfach. Nachteil: Haltestellenhäuschen rücken zu nah an die Straße (wobei ich noch eine Mod plane, die das ausgleicht). Näheres dazu auch unter: https://www.transportfever2.co…?id=modding:tracksstreets

    - Du könntest den Seitenstreifen in der Breite belassen, aber die MaterialIndexTexture so ändern, dass mehr Gras durchscheint. Nachteil: leider nicht ohne viel Aufwand und auf die Schnelle nicht so einfach zu erklären.


    In beiden Fällen ist es sinnvoll, entsprechende Mods selbst zu erstellen und die Originaldateien nicht zu verändern. Es gibt aber auch schon gemoddete Straßen, bei denen der Grünbereich näher dran liegt. Weiß aber jetzt nicht welche. Bei JoeFried könnte was dabei sein. Wenn du da in die Quellcodes reinschaust, findest du nebenbei raus, wie es funktioniert.


    Anpinseln geht natürlich auch als allerschnellste Alternative. Nachteil: Anpinseln senkt die Performance, deswegen sollte man sparsam damit umgehen.

    Hallo zusammen,


    ich beabsichtige, in den nächsten Tagen den "Tramgleis-Texturen-Tauscher für Normalspur" zu veröffentlichen. Das heißt, damit gibt es dann für TPF2 normalspurige Tramgleise (wobei ich mir nicht sicher bin, ob es evtl. schon welche gibt). Einige Fahrzeuge gibt es auf jeden Fall. Es wäre schön, wenn die "Kölner" WLB-Züge auch noch vorbildgetreu auf Normalspur gebracht werden könnten. Weiterhin habe ich bei dieser Gelegenheit festgestellt, dass die Vanilla-Tramgleise nur eine Spurweite von ca. 950 mm besitzen. :( Deswegen werden auch echte Meterspurgleise kommen. Ich weiß aber nicht, ob es überhaupt schon passende Fahrzeuge dafür gibt. Der Rheinbahn-Vierachser ist z.B. auch auf 950 mm eingestellt, was bislang durchaus Sinn machte. Wenn ihr was neu baut, gäbe es ab jetzt aber die Möglichkeit, gleich die richtige Spurweite zu wählen. Es wäre auch eventuell eine Umspurung bei bereits vorhandenen einschließlich diverser Vanilla-Modelle wünschenswert.

    I've tested your guiInit/handleEvent method and - good news - it works! The result is the same as with my "done" flag. Maybe your way is the better programming style, so I will use it definitely. But it is not easy to find out what is officially allowed and what could be a hack.

    Zitat

    The usual way I use guiInit is to send an event to game engine so the game engine process an event at the first cycle of the game.

    I don't know what you refer to "name" and "params", I don't think you need them, since your operation is for all edges on the map.

    This is what I mean:

    Code
    game.interface.sendScriptEvent(id, name, param)

    So could I write

    Code
    game.interface.sendScriptEvent("__foo__", "myEvent", nil)

    :?: At first I thought id could be a number. But meanwhile I think I must use a string like you did. Do the "__" mean anything or is it only for you?

    Zitat

    But also when he wants to use it the second time, it won't work.

    I've implemented a reset mechanism: A selectable "loadGameScript" modifier in the runFn will replace the load function by something else and so break the chain. This works. 8)


    But I will also try out the event thing. You can never learn enough. :)


    By the way, I'm not so happy with upgradeConstruction as I thought before. The disadvantage is error handling! If an error arises - and there will be errors - it will crash, because it does not handle errors by working around like a proposal does. So I invented a special error handler to cope with this thing. ?( But for this I have to use a proposal structure again. ^^ It's a little redundant, but I found no other way. :/

    Zitat

    guiInit is called when the map is loaded and it's called once. You can find usage of it in my zero height bridge mod.

    I found it, but now I do not know:

    - Where do I get the Id from I have to put in? Can it be my own random Id, e.g. "1" ?

    - The same with the name: Can I use a random name?

    - And which are the params? The only params I know are those of my construction. I think that they are not meant. :/

    Zitat

    If you use flags, you can only use it once, from time to time, since once you set the flag, they are saved in the gamesave.lua, it's loaded at the next load, so you deadlock your code.

    Deadlocking would be exactly what I want in my special case :love::D - because I want the user to start my mod only one time and then never again unless it will be resetted. So I just tried out the thing with the flag but It does not even work. ^^


    This is part of my previous code:

    Code
    [...]
    local done = false
    
    local update = function ()
    if not done then
        done = true
        [...]
    end

    You may notice that local done is outside of any functions although it is read by them - but in a test it was not stored, neither in the savegame. Up to now I anyway thougt that values would only be stored in the state table being used in the load and save functions? For this reason I even had created a second flag state.selfDestruction which works wonderful inside load and save, but if I remove this and leave the job alone to done as used above, it does not work. :/ This is very interesting ...

    When upgrading/rebuilding a station in place, the ecs construction is modified in place...

    This seems to be the best way not to destroy the node connections as remove/add does. I found no way to solve it, so I think its better to use update which is now working. The only disadvantage is the missing callback error handler option.

    if you want to execut it once, should sent a event in guiInitHandle and treat it in eventHandle.

    Are you sure that guiInit is not only for initializing GUI elements? I don't have any GUI elements in my script because it works fully independent from the GUI. And I cannot find an example what code I must insert there. :/ I also could not find eventHandle - do you mean handleEvent? Or guiHandleEvent?


    For making update working once I use a done flag which is changed after the first pass. I don't know whether there are any disadvantages.

    Da ich auch gerne eine Weichenbaukasten-Mod mit Schweizer Maßen veröffentlichen möchte, suche ich die exakten Maße aller Normalspurweichen in der Schweiz (Meterspur hab ich), die nicht in jedem Fall identisch mit denen in Deutschland sind. Reine Auflistungen der Typen reichen nicht, ich benötige millimetergenaue Angaben in Form von Tabellen oder noch besser Konstruktionszeichnungen. Leider werden solche Dinge in der Schweiz im Gegensatz zu Deutschland wie Staatsgeheimnisse gehandelt :(, bzw. der Schweizer VÖV scheint eine Art Monopol zu haben und verkauft diese Informationen für sehr teures Geld. :( Ich gehe aber weder davon aus, dass auf den Maßen selber irgendwelche Schutzrechte liegen, noch bin ich ein Stahlwerk, das echte Weichen verkaufen möchte. ^^


    Wer also zufällig eine Maßtabelle o.ä. hat oder weiß, wo man diese kostenlos oder zu erschwinglichen Preisen bekommt, bitte melden. ;)

    I've got news from UG. :) As I assumed, the missing "complete update" is no bug. Optical changes are done, but no technical, because some parameters, e.g. the travel time, have to be calculated anew and this needs time. I have noticed this in my mod, too. If I do a full replacement, the game will freeze at the start for about two minutes. But afterwards everything seems to be ok. The only thing I have to do is to restart some trains which stopped because I virtually tore away the tracks underneath. Perhaps they will realize my idea of an actualizer button. Until then there is my mod, which now seems to work in the intended way. But though I have to do some tests.

    Finally I was successful after VacuumTube had done another test. To make it short: There was still another error in my script. In an old version I had used the "load" function instead of "update", because I thought you can use it if you don't want permanent calls. My edge transformations seemed to work, but also load makes permanent calls and there were other disadvantages. So I finally relocated it to "update" in my main mod. But I forgot it in the shorter experimantal version where I did my upgradeConstruction trials. But upgradeConstruction does not work with "load" at all.


    But that was not all. I also had to set seed to nil - as VacuumTube said.


    Now this is my code:

    Code
    oldConstruction.params.seed = nil
    local newId = game.interface.upgradeConstruction(oldConstruction.id, oldConstruction.fileName, oldConstruction.params)


    The upgrade does connect the tracks! Even switches and I hope also stations. I have not yet tested if it also changes the speed coeffs and other things. Moreover I'm waiting for UG's answer to my bug request.


    I am very happy with it. :) Thanks to you and all who helped me! :thumbup::thumbup::):)

    More likely a bug of the game, have you reported to UG first?

    Not yet. I will do this, but I think it is not a bug, but a safety precaution. Sometimes you want to keep things unchanged you have built before. Imagine - it will change everything on the map! If you don't notice some perhaps unwanted changes, you will save your map and perhaps you can never undo them. I once had a problem with VacuumTube's slope mod. ;) If you don't deactivate a special checkbox, the update of some streets in mountain areas will destroy whole mountains. If you do it manually, you notice this. If you would update automatically, you would not see it, and your savegame could be destroyed forever. I myself know that global updating is a very risky thing - that's why I will be very careful with my update mod. ;)


    But I think something like a special update key or menu would reduce the risk.


    Zitat

    You may keep the nodes from construction side and rebuild edges from free side and using the nodes from construction side so they should get connected.

    You always have the same idea like me. :) But what about two neighboring constructions? ;)


    Zitat

    What about "asset/wk_switch_kit_de_at.con"

    I could send you a pre-version of my update mod, so you could make your own trials - if you want.

    So?

    Code
    local oldConstruction = game.interface.getEntity(constrId)
    oldConstruction.params.seed = nil
    local newId = game.interface.upgradeConstruction(oldConstruction.id, constr.fileName, oldConstruction.params)

    Doesn't work. :(


    I got the error message "attempt to call field 'upgradeConstruction' (a nil value)"


    Now I have inserted the complete code. Doesn't work either. There is always this error message "Assertion `pr.second' failed". I think this routine doesn't like constructions with edges. :(

    Zitat

    Wünschenwert fände ich bei Schienen für Straßenbahnen nicht nur "normale" Weichen, um soleche "Kreisverkehre" vermeiden zu können, sondern auch, dass man bei mehrsprurigen Straßen entscheiden kann, wo die Gleise liegen: Oftmals liegen diese in der Mitte der Straße und nicht am Rand.

    Auc bei Busspuren fände ich so etwas toll: Könnte man den Verkehr komplett auf die innere Spur verlegen, bliebe die äußere, um dort Autos zu parken.

    Meine Rede! ;)

    If I had game.interface as an alternative I would be happy. But I tested it once more. I am a simple thinker :), so I thought that this would perhaps work:

    Code
    params = game.interface.getEntity(constrId).params
    game.interface.upgradeConstruction(constrId, constr.fileName, params)

    Ok, I didn't do this transf thing, but if the params are the same I think it has not to be done ...


    I got this nice short error message ;):

    I do not know what it means but I think I have inserted the wrong params. :D


    But this is what drives me crazy - and this is the reason why I have almost given up this way. :(


    So I will go on with the other method and try to find out if and how I could reconnect the nodes. The question is if I am allowed to write directly into some param structures - and which. I think not ... my last chance is to find some examples elsewhere. Otherwise the changing of the constructions is not so important for the things I want to do.


    [OT] A very simple way to understand my project is to replace the vanilla track types by such with reduced top speed by a mod or a modifier. Now load an old map with already laid tracks. If you press [NUM]-[4] you will see that the top speed has not changed. :(. But if you lay new tracks, you get the right speed for them. So you would have to replace every single laid track by itself. For certain things (like streets with no developement) even the magic wand will not work! :( And this is exactly what I want to have automatized by a mod - but I cannot yet do it for stations, switch modules and so on ... I would be glad if I did not have to write such a difficult mod if the game would at least offer something like the F5-"update"-key in browsers or windows. ;):D If someone could tell me there is a hidden key I would be very happy because then I could program other much more exciting stuff. :S


    But my work won't be useless anyway. It's also a kind of "basic research" ;).

    Ok, now I will answer immediately. ;) Excuse me, that I did not answer, but I did not want to admit that I did not succeed with your suggestion and did not want to ask you too much. I was a little frustrated after I had tried out already so many things. And I did not know that you had invested so much time in helping me. Once more - I'm very sorry for this! :rolleyes: Anyhow, we all have got a solution and learned a lot :), although it is still not perfect. But I hope it could be useful for you, too. Still I do not know why I have to use proposal.old2new at all. It also works without this. :/ I tried out other values than 0, but it always crashed.


    I also noticed that changing edges in a construction is no good idea. So I think changing the construction as a whole is the royal road to handle it - with the disadvantage of destroying the connections. I found out that this happens because the edges get completely new IDs - in opposite to free tracks updated as single edges. I already had the idea that two nodes with the same ID could be connected so I have to thank you for saving a little time instead of a lot of trials.


    Track/street upgrading does exist in vanilla game, but not completely. :( For example, I wrote a mod for lowering the pavements of all streets using a modifier. At a glimpse it seemed to look very good, but if I looked once more I saw all pedestrians and bus shelters hanging in the air, because the engine does only notice optical changes, but not functional. So you would have to update every edge manually with the magic wand or so (I hope this is what you mean). I wrote another mod to reduce the too high track cornering speeds. For new tracks it works very good. But the old tracks keep their old speed coeffs.


    I did not find any better solution than removing every edge and replacing it by itself. Only new tracks are updated correctly! :( If I should have found out a better way, please tell me how.

    Ja, diese Platten kenne ich und hab sie auch schon benutzt. Die Idee wäre aber noch ausbaufähig. Die Texturen könnten den Gehwegen und Straßen angepasst sein, es könnte mehr Größen und mehr Formen geben (auch rechteckig, rund, keilförmig, dreieckig usw.), und man müsste sie auch leicht kippen können. Dann wäre es perfekt. Vielleicht werde ich mich irgendwann einmal selber mit dem Thema befassen, aber dazu müsste ich mich in Blender einarbeiten.