Chaning cargoType in a gamescript

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


  • I'm trying to find out if it is possible to change the type of cargo type when cargo is unloaded into receiving industry.


    I have a producer of eg. "fish_b" and here I have made a custom indicator that fits only in this producer area. When the fish is loaded on to a boat it will make a mess on the load indicator, so that's why I have found and uses the "customCargoModels" in the vehicle compartment as vehicles can have other indicator models


    Now I come to the problem. When delivering at an industry I get the original cargo and here I have the unwanted indicator in the visible stock layout.

    My idea to get the same indicator as I have on the boat, it could be to just find the cargo components in the entities and change the cargoType number. It would be possible to let the "producer industry" create "fish_b" to be transported to an industry that may receive either "fish" or "fish_b" to produces food. I have found that the cargo type for fish has got the value of 16 and "fish_b" is 17 in my test environment.


    But how do I find each component at the industry stock? and when found how to change the value? I have read the WIKI and got some updated info from UG about SimEntityAtStock

    1. I have written a script so I'm searching for constructions with it's name equal to my industry and can find all id:s but I'm stuck to continue to find the cargo type at the industry stock.

    2 Mal editiert, zuletzt von melectro ()

  • addModifier

    ?

    I think I don't understand your post.


    I have seen that if I make a change on the FISH indicator (cargo in res/config/cargo_types) on one of the models it will automatically change the the look for the second mod (if both mods uses "FISH") depending on loading order at game start. That's why I have the idea of two different cargo types, but somewhere between the producer and the industry it must be switched from one type to the other, else the game uses the same cargo on both places and that will have the unwanted indicator in one of the places.

  • I don't think that all single cargo entities can be read out. In Advanced Statistics I use

    Code
    game.interface.getEntities(circle, { type = "SIM_CARGO" })

    but this gives only visible cargo entities.


    There exists another function that retrieves cargos in vehicles (getVehicle2Cargo2SimEntitesMap).

    But for the rest, I didn't found a interface function.


    And even if: It would not be possible to change such values in the game. The api isn't ready for that.

  • The api isn't ready for that.

    So, if there isn't a chance to find the place in the data table where I thought to be "rough" to just change the value, I only have the solution to lower the stock in height to hide the cargo at the industry,:(. It will also have the negative effect that this mod will not be compatible with other mods including FISH.


    The second limitation that I often get into is to trigger animations upon events from other mods e.g. vehicles. In my running project I wish to open the gate at the industry when a train is arriving. I had the idea to integrate a railroad crossing, but as usual it seems not to be possible. If UG had taken the startEvent function from TpF1 into TpF2 I would be a very happy guy, but unfortunately TpF2 will not have that function.:(:(

BlueBrixx