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

[XML + Python] Bamyan Buddha States

Discussion in 'Civ4 - Mod Components' started by cybrxkhan, Jan 31, 2010.

  1. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe

    NOTE: THIS MODCOMP DOES NOT WORK PROPERLY AT THE MOMENT, EVEN THOUGH IT DID WORK PREVIOUSLY IN WORLD OF LEGENDS. IF YOU WISH TO DOWNLOAD IT, PLEASE WAIT UNTIL WE CAN SORT THIS OUT. THANK YOU!


    The Bamyan Buddha Statues modcomp features the Bamyan Buddha Statues wonder that was originally found in cybrxkhan's World of Legends mod/uxp. It will also be introduced into The Capo's upcoming mod, Diplomacy II. Check them out!

    The Bamyan Buddha States increases the amount of missionaries a civ can have at one time from three to five.

    To help modders, all relevant coding in the xml and python are marked with "Bamyan Buddha Statues".

    If you would like to put this in your mod, feel free to - just remember to give proper credit to everybody!


    Credits go to:
    - tsentom1 for the original HERC Factory Next War Wonder that the Bamyan Buddha Statues is based on
    - The J for taking the code and converting it to work with missionaries (he deserves a lot of credit!)
    - The Capo for the wonder nif/model
    - Arian for the wondermovie
    - Cybrxkhan for putting it all together


    Screenshots:









     
  2. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Cool, I'm glad that model actually worked. That's the first building I've made. Well the first one that I made and got released that is.
     
  3. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Hey I was looking at the code for this wonder, and it seems to me like there are some indentation issues here. Can anyone let me know if that would be an issue.

    Code:
    	def canTrain(self,argsList):
    		pCity = argsList[0]
    		eUnit = argsList[1]
    		bContinue = argsList[2]
    		bTestVisible = argsList[3]
    		bIgnoreCost = argsList[4]
    		bIgnoreUpgrades = argsList[5]
    ## BAMYAN BUDDHA STATUES Start ##
                    iMissionary = []
                    iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JEWISH_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CHRISTIAN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ISLAMIC_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_HINDU_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_BUDDHIST_MISSIONARY')    )
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CONFUCIAN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TAOIST_MISSIONARY'))
    		iMoreMissionariesWonder = CvUtil.findInfoTypeNum(gc.getBuildingInfo,gc.getNumBuildingInfos(),'BUILDING_BAMYAN')
    		obsoleteTech = gc.getBuildingInfo(iMoreMissionariesWonder).getObsoleteTech()
    
    		pPlayer = gc.getPlayer(pCity.getOwner())
    		NumReligions = 7
    		for i in range (NumReligions):
                            if eUnit == iMissionary[i]:
                                    if pCity.isHasReligion(i):
                                            pUnit = gc.getUnitInfo (eUnit)
                                            Class = pUnit.getUnitClassType ()
                                            MissionaryCount = pPlayer.getUnitClassCount(Class)
                                            if MissionaryCount <5:
                                                    if (gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
                                                            for iCity in range(pPlayer.getNumCities()):
                                                                    ppCity = pPlayer.getCity(iCity)
                                                                    if ppCity.getNumActiveBuilding(iMoreMissionariesWonder) == true:
                                                                            return True
    
    ## BAMYAN BUDDHA STATUES End ##
    Doesn't look like it so much there, but here's an image (attached) with some helpful red arrows. :goodjob:
     
  4. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    I'm not sure what you mean by indentation issues. So far as I know, the Bamyan Buddha Statues seemed to have worked fine, even with the 'indentation issues'... But if they do cause something weird, please do tell me.
     
  5. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I added an image.

    I guess I'll just go for it, but I don't like putting in incorrect code, it worries me, so I'm worried.
     
  6. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    That's interesting. The code looks perfectly fine when I open it up using notepad.
     
  7. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Alright, this did not work for me. Here is the code I used:

    Code:
    ## Sid Meier's Civilization 4
    ## Copyright Firaxis Games 2005
    ##
    ## Implementaion of miscellaneous game functions
    
    import CvUtil
    from CvPythonExtensions import *
    import CvEventInterface
    
    # globals
    gc = CyGlobalContext()
    
    class DiplomacyGameUtils:
    	def canTrain(self,argsList):
    		pCity = argsList[0]
    		eUnit = argsList[1]
    		bContinue = argsList[2]
    		bTestVisible = argsList[3]
    		bIgnoreCost = argsList[4]
    		bIgnoreUpgrades = argsList[5]
    ## BAMYAN BUDDHA STATUES Start ##
    		iMissionary = []
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JEWISH_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CHRISTIAN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ISLAMIC_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_HINDU_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_BUDDHIST_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_CONFUCIAN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TAOIST_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_OLYMP_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ASEN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_VOODOO_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_SHINTO_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ZORO_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_RA_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_TOLTEC_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_SHAMAN_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_LEVANT_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_DRUID_MISSIONARY'))
    		iMissionary.append (CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_ANUNNAKI_MISSIONARY'))        
    		iMoreMissionariesWonder = CvUtil.findInfoTypeNum(gc.getBuildingInfo,gc.getNumBuildingInfos(),'BUILDING_BAMYAN')
    		obsoleteTech = gc.getBuildingInfo(iMoreMissionariesWonder).getObsoleteTech()
    
    		pPlayer = gc.getPlayer(pCity.getOwner())
    		NumReligions = 7
    		for i in range (NumReligions):
    						if eUnit == iMissionary[i]:
    								if pCity.isHasReligion(i):
    										pUnit = gc.getUnitInfo (eUnit)
    										Class = pUnit.getUnitClassType ()
    										MissionaryCount = pPlayer.getUnitClassCount(Class)
    										if MissionaryCount <5:
    												if (gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
    														for iCity in range(pPlayer.getNumCities()):
    																ppCity = pPlayer.getCity(iCity)
    																if ppCity.getNumActiveBuilding(iMoreMissionariesWonder) == true:
    																		return True
    
    ## BAMYAN BUDDHA STATUES End ##
    
    
    		return False
    And I have attached an image showing it doesn't work (I not only built the wonder, but I built it in the city I am showing this image from).

    EDIT: I think I noticed it says NumReligions = 7, I have to change this for all the other religions I made right? But shouldn't it have worked on the first seven religions then? (Judaism is the first in the list and that's the one I tried it with.)
     
  8. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    i think its quite weak wonder. more effects wouldb be great. maybe 2 free priests or something..
     
  9. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Can anyone CONFIRM this is working? I am unable to get it to work.
     
  10. AbsintheRed

    AbsintheRed Deity

    Joined:
    Jul 27, 2009
    Messages:
    8,278
    Location:
    Szeged, Hungary
    Hm, sry of it's a dumb question, but you had the jewish monastery or organized religion there, right?

    Oh and this gives me an idea.
    This is really a little weak right now. Maybe it would enable the builder to make your missionaries without any requirements?
     
  11. Edgecrusher

    Edgecrusher King

    Joined:
    Aug 7, 2006
    Messages:
    915
    Location:
    Massachusetts
    Capo,

    Did you put the code into your mod via a CustomGameUtils? or just put the edited one in the python directory.

    I only ask, because if using the BUG mod, I dont believe that edited CvGameUtils.py files load or work, a CustomGameUtils.py file (or whatever you want to name it), has to be created, and loaded through BUGs modular python loading system.
     
  12. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I had Organized Religion as a civic.

    Yes I did.
     
  13. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I just want to know if anyone can confirm this works, that's all.
     
  14. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,878
    Location:
    DE/NL/FR
    Nice to see it released :goodjob:.

    @Capo: Are you not able run the modcomp as mod itself to check it :confused:?
    Your second arrow shouldn't harm anything. For the first: Well, could also be a problem with your programm and the intendation, but could also be an intendation error.
    But this one should already throw an exception when loading the mod, so if you don't get one, there's no error at this point.
     
  15. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I haven't done that yet, but I figured that whoever released it would have.

    I guess I could, but that won't really help me out too much now will it? If it works on its own and not in my mod what's the difference? I just wanted to ask if it has been tested yet and for whatever reason nobody has been able to tell me. You'd THINK the person who posted it would be able to answer this pretty easily. But apprently not, so I'll go check it.
     
  16. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    Er... I wouldn't mind if you called me "cybrxkhan"...

    Anyhow, sorry for not testing it earlier, I was too much in a rush to get it out that I forgot to test to see if actually works.

    Anyhow, BAD NEWS -

    Unfortunately, it DOESN'T work, and I'm not sure why, frankly, because it worked in WoL (or at least when I tested WoL). Since I am horridly incapable of python... I guess I'll have to default to The J...? Um, can you please help us? Please? :sad:
     
  17. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Sorry, I guess that was a little rude.
     
  18. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,878
    Location:
    DE/NL/FR
    Can't do anything myself here atm, but if you want to try to fix it:
    The 2 lines marked by the_Capo are the problems.
    Just move both with backspaces to the beginning of the line, and intend them both with tabs to the right position (= matches the lines above and under these lines).
    Edit: Edgecrusher under me is right. First try the XML, then the python.
     
  19. Edgecrusher

    Edgecrusher King

    Joined:
    Aug 7, 2006
    Messages:
    915
    Location:
    Massachusetts
    I just downloaded this and looked at it,
    Cyberkhan, the download doesnt seem to have the PythonCallbacks file in it.
     
  20. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I corrected that, The_J, and it still didn't work. See image.

    EC might be right about the callback, I didn't think about that.
     

Share This Page