1. Firaxis celebrates the "Asian American and Pacific Islander Heritage Month", and offers a give-away of a Civ6 anthology copy (5 in total)! For all the details, please check the thread here. .
    Dismiss Notice
  2. We have selected the winners of the Old World random draw and competition. For the winning entries, please check this thread.
    Dismiss Notice
  3. Old World has finally been released on GOG and Steam, besides also being available in the Epic store . Come to our Old World forum and discuss with us!
    Dismiss Notice

Capital city

Discussion in 'Civ4 - Creation & Customization' started by SIMPA, Jul 30, 2009.

  1. SIMPA

    SIMPA Prince

    Joined:
    Sep 17, 2007
    Messages:
    367
    Location:
    Zagreb,CROATIA
    Pozdrav!
    Does anyone know is it possible to create building throw xml building info that can be build only in capital city.Not to make that city capital,only that can be build in capital city..
    Thx!
     
  2. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    I'm pretty sure you'd need to do this through Python. Shouldn't be that hard though.
     
  3. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    If you're willing to give python a shot, try this:

    From CvGameUtils.py

    Code:
    	def cannotConstruct(self,argsList):
    		pCity = argsList[0]
    		eBuilding = argsList[1]
    		bContinue = argsList[2]
    		bTestVisible = argsList[3]
    		bIgnoreCost = argsList[4]
    		pPlayer = gc.getPlayer(pCity.getOwner())
    		capital = pPlayer.getCapitalCity() 		
    		if not pCity == capital:
    			if eBuilding == gc.getInfoTypeForString('BUILDING_YOUR_BUILDING'):
    				return true	
    		return False
    I also think you need to enable the cannotConstruct function in the PythonCallbacks XML file for this to work. Not 100% that code will function, but it's close, if it doesn't work let me know and I'll see if I can figure it out, but I think that code should work.
     
  4. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    You don't need to use python - iyou can do it entirely in the XML, in CIV4BuildingInfos.xml.

    Just make the building require the Capitol building. The Capitol building is, by definition, always in the capital city.
     
  5. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    Oh, yeah, you're right, you can just make it require the palace... good call.
     
  6. SIMPA

    SIMPA Prince

    Joined:
    Sep 17, 2007
    Messages:
    367
    Location:
    Zagreb,CROATIA

    Hey thx guys i appriciate your help..
    emperor:)
    Hey phungus420 you allways help..you should make new tread in forum "Ask Phungus" :)
    Hehe thx guys:goodjob:
    Pozdrav!!
     
  7. Melendor

    Melendor Warlord

    Joined:
    Aug 7, 2008
    Messages:
    185
    Location:
    Rio de Janeiro, Brazil
    I did some ministries just like that in my Mod. :)
     

Share This Page