Adding Construction blueprint to already existing Object?

Started by Halno, November 17, 2017, 11:43:33 AM

Previous topic - Next topic

Halno

Hello, i'm trying to make a mod that adds several 'advanced electronics' items that the player may build, and one of those is the addition of a constructible flatscreen television. I could add an entirely new BuildingDef for a entirely new flat screen, but that would beat the point. In the game defs the Flatscreen Television already has a standard cost of construction of 100 metal and 10 components, my objective is to add another required item (those being 5x AdvElec_ComponentItem, or "Advanced Components") and to make it buildable after a research is done (in this case, AdvElecMicro, or "Advanced Microelectronics").

I've researched a bit and have seen that one way to change base game files is to use xpathing, would doing what I intend to do be possible with xpathing, and if so, how?

Alistaire

You could do the following:

1) Make a copy of the Def
2) Change those things which are strictly necessary for your mod, e.g add components to the cost
3) Test this def in-game (don't change the defName, this way the game overrides the vanilla def with yours)
4) When all test results are satisfactory, submerge yourself in the wonders of xpathing - there's several guides and threads on the forums and wiki to help you, and if you need someone to tell you what you're doing wrong, there's Discord

Albion

It's actually decently easy once you figured out how patching works. There are some tutorials in this subforum. Just check the pinned threads.
What you need to do is to just do an add operation and add your components to the ingredients list.
Once you have done that the recipe doesn't exist though because as you may know you can't currently build a flatscreen. What you need to do is to add the missing stats similar buildings have.
I'm not 100% sure and can't look it up right now but I think you have to add a workToMake stat in <statBase> so the recipe shows up.

I already did all this in my mod so you are welcome to download it and see how I achieved it: Link to mod
You'll find everything you need in the Patch subfolder.

Halno

Quote from: Alistaire on November 17, 2017, 11:52:57 AM
You could do the following:
I'd guessed that Patching would be the way to go, i'll give a hand at it and see if i do not crash the game into oblivion (again). thanks!