1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

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

Discussion in 'Civ4 - Creation & Customization' started by wotan321, Jan 26, 2010.

  1. wotan321

    wotan321 Emperor

    Joined:
    Oct 25, 2001
    Messages:
    1,218
    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.
     
  2. zyphyr

    zyphyr Prince

    Joined:
    Oct 30, 2005
    Messages:
    461
    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.
     
  3. wotan321

    wotan321 Emperor

    Joined:
    Oct 25, 2001
    Messages:
    1,218
    Location:
    NC, USA
    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.
     
  4. wotan321

    wotan321 Emperor

    Joined:
    Oct 25, 2001
    Messages:
    1,218
    Location:
    NC, USA
    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.
     
  5. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    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.
     
  6. yorkgrass

    yorkgrass Warlord

    Joined:
    Sep 30, 2006
    Messages:
    155
    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!
     

Share This Page