Transport Fever 2

Transport Fever 2

Create your own game world!
Give your game a personal touch and change it to your liking. Create, share and install mods. Customize the game with new landscapes, vehicles, stations, assets and more.
Caliba62 1 31 Aug, 2023 @ 5:42am
need blank industries - pls help
Hey modders,

I'm currently trying to program a mission for TF2 and am currently at hopefully a last roadblock:
I want to enable certain industries only at a certain date.

Now, the date part is not a problem - also not getting the industry to do what I want at that date.
My problem is what the industry looks like until that date:
- I tried to create industries (as .con files) with either 0 capacity or with no input-output-rule at all to then update them when necessary, but both of these options result in picking the industry building tool in the map editor crashing the game.
- I also tried creating regular industries in map editor that I set to 0 capacity at mission start, which... works to a certain point - the mission runs, but selecting the respective industry while it is at 0 capacity crashes the game, I guess the game doesn't have a ui output ready for this case.
- I'd even go so far to basically create them by hand on demand, but couldn't find a command to do that.

I would rather go with the first option if there's a workaround for that, but am willing to do whatever is necessary to get that running.

Kindly
Caliba62

PS: And if someone would know how to edit the maximum industry level, that would be pretty neat too, but is not necessary for the project as a whole.
Last edited by Caliba62; 31 Aug, 2023 @ 11:06am
< >
Showing 1-4 of 4 comments
Bauer33333 10 1 Sep, 2023 @ 8:28am 
there should be multiple misions in the camapin that do this, maybe you can take a look at how it is done there
a mod for more industry levels exists, too
Caliba62 1 1 Sep, 2023 @ 10:49am 
I've looked into the official campaigns and they actually create the industry with capacity at 0 - but as pointed out above, that crashes the game when the entity is selected. So I guess they either added some function that disables the selection of these entities, that I couldn't find yet, or have some other method to create these entities.
I actually had another idea that I'm gonna test tomorrow, which hopefully isn't too dangerous stability-wise: creating industries that produce a ressource that I remove after the map is created. That should make the entity basically a blank building/plot with no function, just a name and an id.

For the industry levels: Are there some that let you set the IL yourself? So far, those I could find only increase the standard max level to some new value, but nothing customizable
Caliba62 1 2 Sep, 2023 @ 3:53am 
Update: I probably found the command that disables selection in the Urban Game mods. They use
"game.interface.setPlayer( <entity id>, nil)"
most likely just assigning the entity to a non-existent player
However, using the command myself leaves me with a crash and an "Assertion `false' failed" error.
And I can't find any other settings in those mods that refer to that command that I could be missing.
Caliba62 1 2 Sep, 2023 @ 6:32am 
Update: Found a workaround in one of Mats' mods
One can define a new player by
"<variable name> = game.interface.addPlayer()"
which one can then assign the industry to with aforementioned
"game.interface.setPlayer(<entity id> , <variable name>)"
The entity can then be reassigned to the player by
"game.interface.setPlayer(<entity id>, player)"
again

Wowies, took me freaking 5 full workdays to get this ♥♥♥♥ together - hope I can soon present results and not run into more obstacles :)
Last edited by Caliba62; 2 Sep, 2023 @ 6:42am
< >
Showing 1-4 of 4 comments
Per page: 1530 50