Posts by brunna

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the Transport-Fever Community

    Yes. Thank You! :D Now I spend more time playing a game and not modifying. But i wanted to watch my trains come randomly, like in real life (mostly the freight trains).

    Hi!


    Me as an "Schönbau" creator i like when a line has a huge of variations of trains, many kinds of trains pass through.

    Previously, i solved this by creating one train storage station:

    Speciel Stations


    My problem was with this solution that the game had to simulate too much trains. This had an effect on performance. And the trains came continuously (not randomly).

    So I created a mode for my save game that can replace the trains randomly from an array, on the selected stations.

    I use my script with my save game with about 50 lines and the arrays have more than 100 vehicles.

    I made an simple save game to show how it works.

    SaveGame


    -It read the train arrays.

    -Checks the trains and their last stops in the update function.

    -If a train has departed from the "replacer" station, then the train got the id of next stop as "stopIndex".

    -The program will realise it and replace the train for another one from the correct array.

    More details in the: random_train_generator.lua


    -- Attention!!!!!!!!!!!!

    -- This mod works with only one save game! You have to copy it as a new one to reuse it for another save!

    -- If you want to delete a train or a line than you must delete first must it here and then in the game!

    -- The mod can be disabled in any time!

    -- Some modded vehicles does not work with this version. But most of them works correctly!

    -- If you have a dump than you can see the last replaced vehicle in the stdout.txt (Line name, array index, train id).

    -- If a vehicle cause a dump then you have to delete the line from the array (array index)!


    I am not a professional mod creator. I am a programmer for the business sector. I created it as a hobby.

    It's not a complete mod. It's an alpha version concept without error handling.

    It can be more dynamic and better.


    I just let it here. Maybe it's a good example for future mods.

    Ich hab es gemacht. Beispiel:


    vehicle1 = game.interface.getEntity (9333)

    config = api.type.TransportVehicleConfig.new()

    tpart = api.type.TransportVehiclePart.new()

    vpart = api.type.VehiclePart.new()


    modelid = api.res.modelRep.find ("vehicle/train/nohab.mdl")


    vpart.modelId = modelid

    vpart.loadConfig = { 0 }

    tpart.part = vpart

    tpart.purchaseTime = 4399000

    tpart.autoLoadConfig = { 0 }

    config.vehicles[1] = tpart

    config.vehicleGroups = {1}


    cmd = api.cmd.make.replaceVehicle (vehicle1.id, config)

    api.cmd.sendCommand(cmd, callback)

    Ich habe die TransportVehicleConfig mit der CommonAPI2- 20200630 überprüft. Vielen Dank für diese API! ;)


    {

    vehicles = {

    <metatable> = {

    __index = <function 1>,

    __ipairs = <function 2>,

    __len = <function 3>,

    __name = "sol.std::vector<TransportVehiclePart,std::allocator<TransportVehiclePart> >*", --Hier ist das TransportVehiclePart.

    __newindex = <function 4>,

    __pairs = <function 2>,

    add = <function 5>,

    at = <function 6>,

    clear = <function 7>,

    empty = <function 8>,

    erase = <function 9>,

    find = <function 10>,

    get = <function 11>,

    insert = <function 12>,

    next = <function 13>,

    pairs = <function 2>,

    set = <function 4>,

    size = <function 3>

    }

    },

    vehicleGroups = {

    <metatable> = {

    __index = <function 14>,

    __ipairs = <function 15>,

    __len = <function 16>,

    __name = "sol.std::vector<int,std::allocator<int> >*", -- Aber ich weiß das nicht.

    __newindex = <function 17>,

    __pairs = <function 15>,

    add = <function 18>,

    at = <function 19>,

    clear = <function 20>,

    empty = <function 21>,

    erase = <function 22>,

    find = <function 23>,

    get = <function 24>,

    insert = <function 25>,

    next = <function 26>,

    pairs = <function 15>,

    set = <function 17>,

    size = <function 16>

    }

    },

    Ich fand, dass die config.vehicles damit kompatibel ist: api.type.TransportVehiclePart.new ()


    z.B.:


    config = api.type.TransportVehicleConfig.new()

    part = api.type.TransportVehiclePart.new()

    config.vehicles[1] = part


    >> part

    {

    part = {

    modelId = -1,

    reversed = false,

    loadConfig = {

    },

    color = {

    x = -1,

    y = -1,

    z = -1,

    },

    logo = "",

    },

    purchaseTime = 0,

    maintenanceState = 1,

    targetMaintenanceState = 0,

    }

    Aber ich habe einen Dump bekommen, als ich diesen benutzt habe. Ich bin mir nicht sicher mit der "modelId". Und ich weiß nicht, welcher Typ mit den config.vehicleGroups kompatibel ist. :(

    Zuerst habe ich das gemacht:


    >> game.interface.getVehicles()

    { 9333, 10452, }


    config = api.type.TransportVehicleConfig.new()

    vehicle = game.interface.getEntity (9333)


    >> config

    {

    vehicles = {

    },

    vehicleGroups = {

    },

    }


    >> vehicle

    {

    allCapacities = {

    PASSENGERS = 66,

    },

    capacities = {

    PASSENGERS = 66,

    },

    cargoLoad = { },

    carrier = "RAIL",

    depot = -1,

    id = 9333,

    line = 2038,

    name = "Train 1",

    position = { 832.64373779297, 604.01354980469, 28.684226989746, },

    speed = 19.335018157959,

    state = "EN_ROUTE",

    stopIndex = 1,

    type = "VEHICLE",

    vehicles = {

    {

    color = { -1, -1, -1, },

    condition = 1,

    fileName = "vehicle/train/br_185_traxx.mdl",

    loadConfig = { -1, },

    logo = "",

    purchaseTime = 59600,

    reversed = false,

    },

    {

    color = { -1, -1, -1, },

    condition = 1,

    fileName = "vehicle/waggon/ew_iv.mdl",

    loadConfig = { -1, },

    logo = "",

    purchaseTime = 59600,

    reversed = false,

    },

    {

    color = { -1, -1, -1, },

    condition = 1,

    fileName = "vehicle/waggon/ew_iv.mdl",

    loadConfig = { -1, },

    logo = "",

    purchaseTime = 59600,

    reversed = false,

    },

    {

    color = { -1, -1, -1, },

    condition = 1,

    fileName = "vehicle/waggon/ew_iv.mdl",

    loadConfig = { -1, },

    logo = "",

    purchaseTime = 59600,

    reversed = false,

    },

    },

    }


    >> config.vehicles = vehicle.vehicles

    error: [string "config.vehicles = vehicle.vehicles"]:1: stack index -1, expected userdata, received table: value is not a valid userdata

    stack traceback:

    =[C](-1): ?

    =[C](-1): __newindex

    config.vehicles = vehicle.vehicles(1): ?


    Leider bleibt die config.vehicles leer. :(

    Ich brauche Hilfe.

    Ich möchte einen Mod schreiben, der Fahrzeuge zufällig aus einem Array ersetzt. (Züge)

    Ich habe die richtige Funktion gefunden:

    >> game.interface.getVehicles()

    { 10452, 10453, }

    vehicle1 = game.interface.getEntity (10452)

    vehicle2 = game.interface.getEntity (10453)

    config = api.type.TransportVehicleConfig.new()

    cmd = api.cmd.make.replaceVehicle (vehicle1.id, config)

    api.cmd.sendCommand(cmd, callback)

    Aber ich kann die "TransportVehicleConfig" nicht richtig mit Daten laden.

    >> config

    {

    vehicles = {

    },

    vehicleGroups = {

    },

    }


    https://transportfever2.com/wi…ml#TransportVehicleConfig

    Könnte mir jemand ein Beispiel dafür schreiben?

    Kann mir jemand ein Beispiel für diese Funktion schreiben "replaceVehicle"? Ich habe es mit die Console getestet, aber ich konnte die Parameter nicht richtig angeben.


    sol.CmdData::ReplaceVehicle.


    >> api.cmd.make.replaceVehicle

    {

    __doc__ = "(Entity vehicleEntity, TransportVehicleConfig config) -> Command",

    }


    Ich habe das versucht:


    game.interface.getVehicles ()

    { 9333, 10452, }


    local vehicle


    vehicle = game.interface.getEntity (10452)


    api.cmd.make.replaceVehicle ( 9333, vehicle.vehicles )

    It's works for me now!!!


    First: I copied every files (EXCEPT THE: .mdl files) from the original mods folder to the emergency mod folder also! AFTER THIS I made the conversion.

    An idea:
    A vehicle replacement list for the lines would be cool. If
    we could add more, different vehicles for replacement. The auto
    replacement could select an vehicle randomly or sequentially.
    I like to use multiple trains on the lines. And it's a horror to replace them one by one.



    I hope someone will make it or will be available in the Transport Fever 2. 8|

    I am sorry but I don't speak German therefore I can't that the Main Connection problem will be solved with the 5112 patch ? ?(

    I did it... I have original game , win 8 x64 built 5080 , and I see the built information at the bottom right corner but it didn't work... Now I reinstall the game... I want to be sure


    Now I could download the new TrainFever.exe and replace the original but The windows doesn't allow me that I run the game I try it again :D But it's half success ! :D

    Maybe... IF I reinstall the game then it will work ? I Hate the Main connection bug..... it's very very annoying.... :D

    First I upload : TFPatchPlus_02_TrainFever_exe_64Bit_5080.patch from the TFPatchPlus_02_TrainFever_exe_64Bit_5080.patch.rar (Is it the .patch.bz2 ?) Second I Upload the Train Fever.exe from the game folder... and I got this error :Shttp://imgur.com/tfS2Urc there is a picture

    I can't make it... I load the TFPatchPlus_02_TrainFever_exe_64Bit_5080.patch after the Train fever.exe from the main folder but I get this error : Loading file to apply patch to...
    File: TrainFever.exe (Size: 24966736)
    Applying Patch...
    Patchheader:
    In Size:24966736
    In CRC32:-306994673
    ERROR: Calculated CRC32 mismatch:-1817493762


    My game version is 5080
    And I have Windows 8.1 x64...