Need help with industry modding. Different goods output based on input.

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


  • Sup, here is my problem: i need to make an industry which will output OR good1 OR good2 depending on the input.
    Example - canning factory, IN - Fish/Meat , OUT - Canned fish OR Canned meat, not both.

    Didnt find any reference on that and discord is deady silent.

    TF2.

    Not working code looks like this:
    Adding new 'rule' doesnt work
    Adding output {{ }} also doesnt,


    local stockListConfig = {

    stocks = { "MEAT","FISH", "COFFEE","CANS" },

    rule = { input = { { 1,0,0,0 }, { 0,0,0,1 } }, output = { CANNED_MEAT = 1 , CANED FISH = 1 }, capacity = 100 },

    }

  • s1lverw0lf

    Hat den Titel des Themas von „Need help with industry modding quiestion. Different goods output“ zu „Need help with industry modding. Different goods output based on input.“ geändert.
  • The general structure of the "rule = " line leads me to expect that the game does not really allow for multiple products based on what inputs are provided.


    I have found those industries a little inflexible: they basically prefer to create 1 product from 1 raw input with production speed governed by output rate: you get the scripted amount of products in each step, using whatever amount of supplies the script requires. If You want the factory to produce some small scale waste product on the side (e. g. for each batch of lumber 1/4 batch of sawdust), this is only possible by writing the ratio as 4:1 instead of 1: 0.25, massively and unrealistically speeding up production. And if You want to have a slow-paced, uneconomic production in the basic, unexpanded factory, it is not helpful to script 3 raw materials for 1 product either: then the factory will just burn through the supplies at maximum speed while still churning out the product at normal rate.


    So I´d concur with VacuumTubes advice here. A general-purpose cannery (like in Tropico) is likely not possible within the games constraint - consider to split it up into a corned beef factory, a sardine cannery and a coffee roasting plant, each requiring their individual raw product and either steel or prefabricated empty tins as supplies. This would be easy to script.

  • Well i'm making a big industry mod based on Railroad Tycoon 3 balance mostly , with differents industries opening at different ages, and producing various stuff. I guess the number of goods is now around 100
    so there IS a need of industry optimization through lowering down the amount of separate productions.
    I guess there is an answer in industryutil or cargoutil somewhere, but the code there is too advanced for my understanding.

    There is a freestyle industries mod, which does that, but it's also scripted in a very advanced manned and caan be hardly used as a reference

    DH-106, how do you balance the ratio as 4:1 though?

    Einmal editiert, zuletzt von Sebastianeh () aus folgendem Grund: Vollzitat vom vorherigen Beitrag entfernt, bitte Forenregeln beachten.

  • What an industry consumes and produces is ultimately determined in its updateFn. In the vanilla industries, the stockListConfig table is used as the basis for creating the rule.

    Therefore, whenever an industry's updateFn is called, you are in a position to redefine what it is doing (assuming you have defined your own updateFn, rather than letting industryUtil.lua do it for you.)

    This could be by way of a date determination, or by user input through menu parameters, or both, or something else entirely. You're still stuck with one input rule and one output rule at a time, but they can be changed easily enough.

    The updateFn is called each time the user clicks on the industry's configuration menu, as well as when it is built. Also, when you use some type of script event to make a change to it.

    @xmnovotny's Bulk upgrader for stations/industries set's the ownership of the station or industry to call its updateFn. This has the downside of charging the player with the maintenance costs of the industries, but you can avoid that by simply setting the maintenance costs to a nominal value.

  • Necro:


    In this example

    from original

    Code
    stocks = { "BEER","BOTTLE" },
    rule = { input = { { 1,1 } }, output = { BEERBOTTLE = 1 }, capacity = 100 },

    to edited

    Code
    stocks = { "BEER","BOTTLE" },
    rule = { input = { { 3,2 } }, output = { BEERBOTTLE = 3, SCRAPGLASS = 1 }, capacity = 100 },

    is the last rule,

    Code
    capacity = 100

    where X = for each single output entry (if there are more than 1) or does X mean the sum of all outputs, so then it should be

    Code
    stocks = { "BEER","BOTTLE" },
    rule = { input = { { 3,2 } }, output = { BEERBOTTLE = 3, SCRAPGLASS = 1 }, capacity = 400 },
BlueBrixx