[Solved] Coal Liquefaction - Possible?

naed21

Chieftain
Joined
Feb 17, 2019
Messages
4
I'm currently trying to see if I can get a Coal Liquefaction Building to work. I noticed that there is a Building_ResourceCosts table in sql so I tried a test building with Coal set as PerTurnMaintenanceCost as 4 and Oil as PerTurnMaintenanceCost as -1

As you can guess, its not working. The in game UI shows the Coal Accumulation as "+-2" and Oil as 0 (I got 2 Coal mines so +6 per turn, then I built 2 test buildings). There are two problems. 1) There appears to be a floor on the PerTurnMaintenanceCost property. 2) The maintenance cost doesn't appear like the Unit mainteance does and instead is added to the Accumulation total (instead of a seperate element).

Nothing else uses this table so I'm concerned that this was something not fully implemented. I'm new to modding Civ6 so I'd like to know would it be possible for me use Lua to add the functionality that I'm looking for (Either something new or modify how Building_ResourceCost works) or do I need to pray to the Devs that they add this functionality in a future update?

Edit: Success! https://steamcommunity.com/sharedfiles/filedetails/?id=1660410526
 
Last edited:
for the oil, use a modifier. I don't think negative maintenance works.
 
Ok, so I found the Great Person Modifier for Oil. Which uses the Modifier: MODIFIER_SINGLE_CITY_ADJUST_FREE_RESOURCE_EXTRACTION

So now I just need to have it add that modifier when the building is created and then I have a project to remove the building, so I'll need to remove the modifier there. Sounds like it'll work.

Should I do the same for the Coal Consumption? I don't think I should be using that Building_ResourceCosts table at all considering that weird UI bug. I'll give it a try later tonight.
 
It's not a wierd bug so much as the UI file was not written to handle the conditions you are attempting. It was written as one building requires one type of resource, one unit requires one type of resource.
 
And as an FYI you cannot alter how a game-table actually works via any lua script, whether a UI script or a GameplayScript. How the gametables work is controlled entirely in the game's DLL source code to which we do not have access.

You can modify and 'correct' wierd and inconsistent behaviors in how a UI file displays things, but this does not actually change how the game or any of its SQL tables work under the UI hood.
 
Makes sense.

Speaking of stuff it wasn't ever created to do, running out of coal doesn't turn off the building modifier. Not sure how to go about resolving that issue... I don't suppose there is a way to use Lua to loop through the cities and remove a modifier or auto run my Decommision city project when the coal runs out (like if the tile gets pillaged or the stockpile runs out).

Another weird issue: I set my modifier to Permanent: False so when my Decommision city project consumes the building, it removes the modifier as well. But during my testing a spy destroyed the building and repairing it didn't bring back the modifier. Is there some repair action or modifier type I need?
 
You cannot remove a modifier via lua. You can only add a modifier to a city or player via lua, and only since the GS patch and probably only with GS.

So far as the other issue re the decommissioning and the spy destruction: not sure
 
Ok, so the repair issue was caused by the Modifier having RunOnce:True. Setting it to false returns the modifier after the building repairs.

Thinking about coal running out, I'm kinda thinking its fine the way it is. It leaves your stockpile at 0 so you can't build railroads and your battleships will suffer a combat penalty.

Thanks for the help, I'll clean it up and post it at some point.
 
Top Bottom