STEAM GROUP
Forest Village Modding LiF:FVM
STEAM GROUP
Forest Village Modding LiF:FVM
1
IN-GAME
46
ONLINE
Founded
5 December, 2016
Language
English
MEGADORI 9 Oct, 2017 @ 9:39am
[Solved] Upgradable building
Greetings fellow builders :)


Has anybody yet achieved to make a modded builing that upgrades to a second modded building?

I am trying my hand at it but sadly I just can't get the upgrade part to work, so hopefully somebody can give me a hint :)

Both building versions work comletely fine on their own
https://imgur.com/a/msfdB

I also have a building window with the upgrade page on the first one
https://imgur.com/a/pI7df

But as soon as I add to the config the line:
upgrade = "megadori_church2",

the game crashes on loading and the log gives me:

[BuildingConfig.cpp | 92]
2017-Oct-09 18:32:19 upgrade [megadori_church2] not found [BuildingConfig.cpp | 255]
2017-Oct-09 18:32:19
Main Call Stack: empty
Cegui call stack: empty
Thread#0 call stack: empty
Thread#1 call stack: empty
Thread#2 call stack: empty
Thread#3 call stack: empty
Thread#4 call stack: empty
Thread#5 call stack: empty
Thread#6 call stack: empty
Thread#7 call stack: empty
Thread#8 call stack: empty
[LuaMachine.cpp | 470]
2017-Oct-09 18:32:19 LuaMachine::startNewGameSession [LuaMachine.cpp | 228]
2017-Oct-09 18:32:19 GameMap.loadLevel ERROR! Exception unknown [GameMap.cpp | 3565]
2017-Oct-09 18:32:19 LOAD ERROR! Exception unknown [FileLevel.cpp | 277]
2017-Oct-09 18:32:19 Unknown exception [ForestVillage.cpp | 157]
2017-Oct-09 18:32:19 STOP [ForestVillage.cpp | 157]
2017-Oct-09 18:32:19 <<<<<<<<<<<< APP CRASH >>>>>>>>>>>>

So I understand that the game can't find my modded building, but I don't know how to solve that :(
This is generally a problem for me, in another mod I tried to provide some modded crafting recipes at a modded building, but can't because I don't know how to properly refer to modded buildings.

Anybody got a tipp for me? :)
Last edited by MEGADORI; 26 Oct, 2017 @ 4:55am
< >
Showing 1-9 of 9 comments
cstoneburner 9 Oct, 2017 @ 11:08am 
Are they the same size in footprint? If no, then that's your problem (although they look like they should be the same model size at least) .

Are they in the same mod? The same file? If not the same mod then you probalby need to name them with the mod number (sorry don't have the format at hand) I'm not sure about if they are in different files in the same mod.
MEGADORI 9 Oct, 2017 @ 11:25am 
They are the same size and in the same file.
If I refer to the mod number, how would I add the building name?
dominuskevin 9 Oct, 2017 @ 4:22pm 
Off hand, not sure it realy matters, but houses and other buildings which upgrade have seperate files.Could that make a difference in how they are called? Kinda doesn't make sense but I like your stuff and would like you to succeed. :>)
MEGADORI 10 Oct, 2017 @ 7:50am 
I think I found out ...something:
When I put
upgrade = fv["1159861622"].megadori_church2,

or only

upgrade = fv["1159861622"]

the saves load, no error message, but church1 still doesn't upgrade to church2 ... it seems the game wants something else
MEGADORI 11 Oct, 2017 @ 3:07am 
It doesn't seem to matter if I put the upgrade building in a seperate file or even in a seperate mod, the outcome stays the same: No error, but no upgrade either :(

Maybe I am doing something else wrong, could I be using the wrong upgrade page or somthing?
cstoneburner 11 Oct, 2017 @ 3:12am 
@MIB, @Alprog, what IS the right way for modded buidlings to be upgraded?
MEGADORI 16 Oct, 2017 @ 2:20am 
I have uploaded the church mod (part 1):
http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1159861622

The lua includes the code for the upgrade building. If anybody wants to take a look and have a go at the upgrading function :)
MEGADORI 26 Oct, 2017 @ 4:56am 
The solution found by Sir Foxy looks like this:

upgrade = 'modID.buildingname',

e.g.
upgrade = '1159861622.megadori_church2',
MEGADORI 8 Nov, 2017 @ 6:01am 
If anybody wants to make mods that include building upgrades, watch out:

If a mod inherits its functions from an existing building, it will also inherit the config and thus any upgrades, if not defined otherwise.
(example: the church mod inherits from the bathhouse
megadori_church = Class('megadori_church', fv.core.Bathhouse)
megadori_church2 = Class('megadori_church2', fv.core.Bathhouse)

If another mod makes the original vanilla building upgradeable like so:
fv.core.Bathhouse.config.upgrade = '1190912801.megadori_bathhouse'

then that upgrade-data will be taken over by any modded buildings that inherit from the bathhouse and don't have a config line for their upgrade. That way the game takes the data from the mod that upgrades the vanilla building and finds that the building footprints of the two mods don't match, causing a crash

2017-Nov-08 14:05:31 Error: size of building upgrade [1190912801.megadori_bathhouse] is not equal to original building[1159861622.megadori_church2]

It crashes upon comparing with megadori_church2 and not church, because megadori_church has its own upgrade data, whereas megadori_church2 doesn't. Meaning: The crash doesn't have anything to do with the fact that the church is upgradeable, but with the fact that any mod building that doesn't have its own upgrade will be affected.

My conclusion is that any mods that make vanilla buildings upgradeble would be incompatible with any other mods that inherit from that vanilla building.

I don't know if there can be a solution to this other than alerting anybody who adds a mod that inherits from the bathhouse.

There are 3 ways to avoid the problem when making modded buildings:

1.
If the mod building doesn't have a window (like the bathhouse, well, etc) it is enough to add this to the config:

upgrade = "",

2.
If the building does have a window, the game will complain about the lack of upgrade data, so you have to set the building as its own upgrade like this:
fv.core.MODBUILDING.config.upgrade = 'modID#.MODBUILDING'

If the building inherits its window function from the vanilla building, this solution will lead to the mod building being endlessly upgradeable to itself. To fix this, give it its own window function like this:

function MODBUILDING:createWindow()
return fv.core.BuildingWindow(self, {pages})
end

e.g. { ProductionPage, WorkersPage } for a craft building

3.
For buildings that look different and work different than a vanilla building (so they have their own functions anyway), don't inherit from a vanilla building at all but from the parent building class
MODBUILDING = Class('MODBUILDING', fv.core.Building)
or
MODBUILDING = Class('MODBUILDING', fv.core.CraftBuilding)



Also, naturally a mod that makes a vanilla building upgradeable will be incompatible with any mod that changes the footprint of that building, except of course when the footprint of the upgrade is made to match the modded vanilla building footprint, which can be done like this:

fv.core.VANILLABUILDING.config.widthCells = #value
fv.core.VANILLABUILDING.config.lengthCells = #value
MODBUILDING.config.widthCells = fv.core.VANILLABUILDING.config.widthCells
MODBUILDING.config.lengthCells = fv.core.VANILLABUILDING.config.lengthCells


This way, if another mod overwrites the original footprint size, the upgrade should still work
Last edited by MEGADORI; 8 Nov, 2017 @ 7:13am
< >
Showing 1-9 of 9 comments
Per page: 1530 50