How do building replacement and prereqs work?

pepper2000

King
Joined
Apr 14, 2013
Messages
899
I am working on a space colonization modmod and hope to have it posted soon. But I have gotten stuck on a building replacement issue.

Suppose Building B replaces Building A (using the ReplaceBuildings tag), and Building X requires A (using BuildingClassNeededs). In my testing, it seems that if I build A, then X, then B, X continues to function. But if I build A, then B, then I am no longer able to build X.

I want to add late game replacements for some older buildings (e.g. Starport replaces Commercial Spaceport) without breaking dependency chains or having to modify every building that depends on the older one. What is the best solution to this?
 
Looking more carefully at the existing building XML, it looks like replacement simply doesn't work in the way that I wish it did. I can solve it by restructuring my dependency trees.
 
Yes if you are replacing a building you have to ensure that your replacement building allows the same buildings as the one you are replacing.
 
lol... I tried to solve this in the code once but it caused too great a slowdown. There's a better way to do it but I've not taken the steps to and I can hardly remember how I'd need to now that it's been a bit... could figure it out though and I probably will again at some point. This IS a frustration... I had the same issue when looking at using the Doctor's Office to base the medical special universities on - couldn't do it because the new Surgeon's Office is a replacement to the Doctor's Office now. I wasn't sure how to set it up so that either building could qualify the Wonder to be built based on the national count of those buildings across all its cities. I don't think it CAN be done for that tag prereq actually.
 
Thanks for the info. Thunderbrd, I had attempted to do a very similar thing (either 5 spaceports or 5 starports to build a wonder), and I couldn't figure it out. Glad it's not just me.
 
There are reasons that it was coded in the building that was being replaced but that was way back in the early RoM:AND days and even I can't remember the reasoning now.
 
There are reasons that it was coded in the building that was being replaced but that was way back in the early RoM:AND days and even I can't remember the reasoning now.

That's not really the issue but it IS another frustrating aspect of it. Seems it would be more intuitive if it was setup the other way. When you add a new building to a sequence, you'd think of 'what buildings does this building replace' rather than, 'what buildings do I need to adjust so that this building can replace them'? I've found that extremely annoying. But it's not a big 'nuff deal to try to change it.

But that some tags cannot work off of a building because it is a building that gets replaced... now that there is frustrating stuff.
 
I think what confused me is that the Mining Bot Control Center requires the Automated Vehicle Dealership, which is replaced by the Shockwave Vehicle Dealership and the Antigrav Vehicle Dealership. Seeing that made me think it's OK, but maybe that is something that needs to be fixed.
 
This is another reason for so many bonuses, you can sometimes replace some of the required buildings with the bonus they make.

I have thought that we can use auto buildings to replace some of these requirements that we can't do in the XML. It is one of the reasons I added in the Myth and Story requirement buildings. I have thought we should have an auto building "Stabling Available" which requires one of the three stables and therefore only have that in the XML for the buildings that require one of the three. It simplifies the XML but has a downside that it is more confusing for the player.
 
That sounds like something out of Silicon Valley. "We're not a stable. We're a stabling services provider". I had thought about doing an auto building "Space Access" but decided it wasn't worth the trouble.
 
Back
Top Bottom