With XML or LUA, is it possible to use World Congress to modify, delete, or disable buildings?

irnf

Chieftain
Joined
May 30, 2020
Messages
11
I am making a lord of the rings mod, and one of the features I would like is to have the Ring represented as a world wonder. I also want to have a "Quest of the Ring" international project that prevents anyone from getting it, but only if it has not already been built. That way there is a fun race between players working together to destroy it, or trying to get it for themselves.

But after thinking about it I'm not sure if such a relationship is even possible.

One way I've thought about this is to have different buildings of the same class. Let's say one is the "ring", available to "evil civs" through buildingclassoverrides, and one is "the ring is destroyed", available to "good civs" through buildingclassoverrides. "The ring is destroyed" could be given for free to the winner of the international project, and if it's a world wonder, then that would prevent anyone else from getting the "ring" because it's the same class.

The problem with this approach is that if an evil civ (whose version of the same class is the "ring" not "ring is destroyed") conquers the city, it will be converted into the other version. Just like how when any civ that has a unique building conquers a city with a generic, it gets converted into the unique.

So as far as I can tell, I don't think the mechanism I want is possible using XML.

I'm experienced with XML, but have no experience with LUA. Does anyone with experience want to chime in and just tell me whether they think this would be possible? And if it is just point me in the right direction and I can figure it out.

For example, is there any way that once a certain international project is complete, the construction of a particular building or buildingclass is simply blocked map-wide? Maybe by giving a free building to the winner that blocks the other building map-wide?

Or, is it possible with LUA to give a particular technology to every civ in the game once an international project is complete? That way I can at least use an obsolete (otherwise inaccessible) tech so that even if the AI stupidly builds the ring, it won't do anything.

PS: I know about the Building_LockedBuildingClasses table but that only affects one city, not the whole map. I basically would want one world wonder (representing the ring being destroyed) to block another world wonder (the ring) map-wide, so only one of them can exist.

Thanks

Moderator Action: Welcome to CivFanatics. Moved this thread to the main C&C forum as that is where questions are posted. leif
 
Last edited by a moderator:
Hello everyone. For reference, I figured out how to do what I want entirely in XML. I will explain it here, since I think it is interesting.

I thought it couldn't be done, but I sat down and actually started drawing out diagrams, and it turns out that by using "building logic" with prerequisites, Building_LockedBuildingClasses, and FreeBuildingThisCity, you can create a functional system that works intuitively and avoids paradoxes.

Essentially there are two world wonders that I want to have: I call them 1) "Claim the One Ring", representing just that, and 2) "Ring-Bearer Memorial", representing the Ring being destroyed, and the latter needs to somehow be tied to the Quest of the Ring international project. But I need a system so that only one of them can exist in a given game world, otherwise that's a paradox.

The key is to have two completely separate world wonders, belonging to separate building classes, that reciprocally give each other using
Code:
FreeBuildingThisCity
. This means that once one of them is built anywhere on the map, the other one is also given to the same city, so they can only exist together in the same city. This makes it so that when one of the world wonders is built, the other one is also disabled for every other city on the map. They are twin wonders, only able to coexist in the same city, not separately.

But those twin world wonders don't actually do anything and only take one turn to build. They only serve as prerequisites for the actual world wonders: "Claim the One Ring" and "Ring-Bearer Memorial".

So that prevents anyone else on the map from claiming the Ring if you are destroying it, or destroying it if you are claiming it. But how do you stop yourself from paradoxically building both the "Claim" and "Memorial" wonders in the same city? After all, by design, both their prerequisites already coexist together in the same city.

That last part is actually simple, you just give each of the "twin" wonders their own, separate, prerequisite wonders, each representing the option of either claiming or destroying the ring. And then you use
Code:
Building_LockedBuildingClasses
to disable "Claim the One Ring" if you have the prereq wonder representing the "destruction building path", and conversely disable "Ring-Bearer Memorial" if you have the prereq wonder representing the "claim building path".

Attached is a diagram of the full system. I have not tested it exhaustively and it might not be balanced in terms of production costs yet, but I have confirmed that the game loads and plays fine and as far as I can tell in the civilopedia, the relationships are all correctly done by the game.

Also thank you to the mod for moving the thread.
 

Attachments

  • ring wonder diagram.pdf
    32.3 KB · Views: 155
Last edited:
Hello lurkers. I just have one more question - I'm basically finished with this whole mod now and would like to post an announcement. Can I do that in the main C&C forum? It does not really fit into any of the categories like "new civilizations" or "scenarios".
 
The main C&C forum, or the (badly named) Mod Components sub-forum
 
Hey thanks, if all goes well I'll post it today. I've had some crazy bad luck with computer issues and with real life getting in the way of this.

I also am making this last post in this thread to update the information about the Ring feature. The idea that I drew out and described earlier does not actually work, because the free wonders given by freebuildingthiscity apparently do not actually count towards the maxglobalinstances, and thus do not actually prevent other players from building the other wonder.

But all is well. I've devised, tested, and confirmed to work, a new system, that uses a hidden resource instead.
 

Attachments

  • ring wonder diagram.pdf
    43.4 KB · Views: 127
Top Bottom