How do you have building A OR building B in a city?

wotan321

Emperor
Joined
Oct 25, 2001
Messages
1,228
Location
NC, USA
I'd like to have some buildings available so that you can have building A or building B or building C, but not more than one of them at a time.

I know its been done, but I don't recall how.

Any help is appreciated.
 
This belongs in the main C&C forum, this area is for completed tutorials, not questions.

Now, for the actual answer...
you have two options that I am aware of :

If you want 'If you have A, B and C are unavailable'

1)Use python, and put checks in place in the CanBuild function. This is the easier option, but has the disadvantage of being a pain to maintain/extend.

2)Use the SDK to add new a new XML tag to buildings marking them as mutually exclusive and then add code to actually make the tags function. Much more work, but once done is easier to use and keep track of. I am reasonably certain someone once released a mod that does this, but I don't feel like searching for it.

If you want 'Building A deletes any copy of B or C in the city, but you can always rebuild the B/C and lose the A', there are two differences in what you need to do :
Instead of modifying CanBuild, you would use onBuildingBuilt to delete the preexisting building

Also, and this is an absolute must : You would need to mod the AI build routines in the SDK to prevent "Build A, now I want a B, oh, I could use an A, now a B would be great" loops.
 
Wow, I am surprised there is not a XML tag somewhere. Didn't there used to be or am I thinking of Civ3 or earlier? Thanks for your help though, I appreciate you taking the time to describe a solution.

As for the wrong forum.... you are correct. Sorry for the misplacement of the thread.
 
Now I know where I saw this.

Dom Pedro II built this feature into a xml tag in the "Test of Time" mod. You can list which buildings replace other buildings.
 
Wow, I am surprised there is not a XML tag somewhere. Didn't there used to be or am I thinking of Civ3 or earlier? Thanks for your help though, I appreciate you taking the time to describe a solution.

As for the wrong forum.... you are correct. Sorry for the misplacement of the thread.

Now I know where I saw this.

Dom Pedro II built this feature into a xml tag in the "Test of Time" mod. You can list which buildings replace other buildings.

I have this as an XML tag too. It allows you to set a list of buildings that the city can't have in order to build this building. If you need help or want to merge it to your mod, I'd be more than willing to show you how to add it.
 
I have this as an XML tag too. It allows you to set a list of buildings that the city can't have in order to build this building. If you need help or want to merge it to your mod, I'd be more than willing to show you how to add it.

Hey Afforess, I dono if he wanted it, but I really do! the problem is I have already changed a lot in the xml (xml only, no sdk or python changes), do I have to re enter all the changes if I want to use your mod?

thanks!
 
Top Bottom