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

Mod Component Requests Thread

Discussion in 'Civ4 - Mod Components' started by Thunderfall, Jun 15, 2006.

  1. CrimsonEmperor

    CrimsonEmperor Chieftain

    Joined:
    Jan 8, 2010
    Messages:
    17
    Location:
    Atlanta.
    As for SDK anyone got a dl link? The one on Civ IV website has no MySQL support (sombody didn't update a database). Any mirrors?
     
  2. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,774
    Location:
    DE/NL/FR
    :think: oh, you're right.
    :think: but did not GIR make something like that?

    The SDK is included in the installation of civ ;).
     
  3. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    @The_J; AbsintheRed made a good point, he said it was more "Romanesque" to be able to train your VASSAL's UUs. Which I think is a good idea too, so I might be able to tweak Topkapi palace into doing that, but I noticed it says you have a "chance" to build your vassal's UBs and I'd rather remove the chance and just give the ability. I'd still like for it to give you the ability to train enemy UUs in their cities that you conquer too. But if that is too difficult to do with python (or unweildy as far as performace goes) I can accept that. So what do you think?
     
  4. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,774
    Location:
    DE/NL/FR
    Try this here:
    PHP:
        def canTrain(self,argsList):
            
    pCity argsList[0]
            
    eUnit argsList[1]
            
    bContinue argsList[2]
            
    bTestVisible argsList[3]
            
    bIgnoreCost argsList[4]
            
    bIgnoreUpgrades argsList[5]
    ###from here
            
    pPlayer gc.getPlayer(pCity.getOwner)
            if 
    pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_WHATEVER"))>0
                
    iOldPlayerID pCity.getPreviousOwner ()
                if 
    iOldPlayerID >=0:
                    
    pOldPlayer gc.getPlayer(iOldPlayerID)
                    if 
    pOldPlayer.canTrain(eUnit,True,bTestVisible):
                        return 
    True
    ###until here
            
    return False
    I don't know, if that will work.
    I suggest, first testing this in a dummy/test mod, because i expect, that it could crash (25% chance of so, i guess).
    I also expect some problems, when your enemy has more advanced techs than you, because you might be able to train advanced units, even when you don't have the necessary tech. Please check that in the worldbuilder
    Don't forget to activate the python callback in the XML.
     
  5. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Alright, it might take me a couple of days to get it tested, but thanks a lot. I'll let you know.
     
  6. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I have another question. I am adding a wonder to my mod and I want it to have these attributes:
    • Free Great Artist
    • +1 Happiness in all cities for each theatre
    • +1 Happiness and +2 Culture from Hit Musicals and Hit Singles

    I think I mentioned this before and I was told it was doable with XML. I'm looking at the BuildingInfos file and I can't really tell how to do this. Is there another file I have to edit to to get these effects? Can anyone help me out on this one?
     
  7. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Sorry, one more question for you The_J. This is about my plan for the Flavian Amphitheatre wonder.

    Currently, in my GameUtils file I have this code:

    Code:
    ## 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 = 18
    		for i in range (NumReligions):
    						if eUnit == iMissionary[i]:
    								BugUtil.debug("Unit %d is a missionary for religion %d", eUnit, i)
    								if pCity.isHasReligion(i):
    										BugUtil.debug("City has correct religion")
    										pUnit = gc.getUnitInfo (eUnit)
    										Class = pUnit.getUnitClassType ()
    										MissionaryCount = pPlayer.getUnitClassCount(Class)
    										if MissionaryCount <6:
    												BugUtil.debug("Player has less than 6 missionaries")
    												if (obsoleteTech == -1 or not gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech)):
    														for iCity in range(pPlayer.getNumCities()):
    																ppCity = pPlayer.getCity(iCity)
    																if ppCity.getNumActiveBuilding(iMoreMissionariesWonder) > 0:
    																		return True
    
    ## BAMYAN BUDDHA STATUES End ##
    You probably recognize that. My first question is if I can still add the Flavian stuff to this and the second question is how to do it. Is this correct?

    Code:
    ## 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 = 18
    		for i in range (NumReligions):
    						if eUnit == iMissionary[i]:
    								BugUtil.debug("Unit %d is a missionary for religion %d", eUnit, i)
    								if pCity.isHasReligion(i):
    										BugUtil.debug("City has correct religion")
    										pUnit = gc.getUnitInfo (eUnit)
    										Class = pUnit.getUnitClassType ()
    										MissionaryCount = pPlayer.getUnitClassCount(Class)
    										if MissionaryCount <6:
    												BugUtil.debug("Player has less than 6 missionaries")
    												if (obsoleteTech == -1 or not gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech)):
    														for iCity in range(pPlayer.getNumCities()):
    																ppCity = pPlayer.getCity(iCity)
    																if ppCity.getNumActiveBuilding(iMoreMissionariesWonder) > 0:
    																		return True
    [COLOR="Red"]        if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_FLAVIAN_AMPHITHEATRE"))>0:  
                iOldPlayerID = pCity.getPreviousOwner () 
                if iOldPlayerID >=0: 
                    pOldPlayer = gc.getPlayer(iOldPlayerID) 
                    if pOldPlayer.canTrain(eUnit,True,bTestVisible): 
                        return True [/COLOR]
    ###until here 
    ## BAMYAN BUDDHA STATUES End ##
     
  8. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,774
    Location:
    DE/NL/FR
    Yes, that looks correct, that should work.

    But like said, i don't suggest directly trying it with your mod, because the untested code will maybe lead to a crash.
    Create a dummy mod for that.

    Great artist: Look at the temple of artemis.
    +1 :) for theatre: There's BuildingHappinessChanges in the buildingsInfos.xml, it seems to be unused, and no idea, if it works.
    +1 :) from hitsingles: Only for this city? If yes, look at the market ;).
    +2 culture: Can't be done in XML, and can't really be done in python.
     
  9. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    I mean a Great Artist Unit, AFAIK the Temple of Artemis doesn't do that (and if it does, I'm an idiot and should start building it).
     
  10. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,774
    Location:
    DE/NL/FR
    Ups, sorry, no, Artemis doesn't do that.
    But this code should do it:

    PHP:
        def onBuildingBuilt(selfargsList):
            
    'Building Completed'
            
    pCityiBuildingType argsList
            game 
    gc.getGame()
    ###from here
            
    if iBuildingType == gc.getInfoTypeForString("BUILDING_YOUKNOWWHATYOUWANTHERE"):
                
    pPlayer gc.getPlayer(pCity.getOwner())
                
    pPlayer.initUnit(gc.getInfoTypeForString("UNIT_ARTIST"),pCity.getX(),pCity.getY(),UnitAITypes.UNITAI_ARTIST,DirectionTypes.NO_DIRECTION )
     
  11. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Thank you.
     
  12. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    Not to ruin The J's great coding, but another way to give a free Great Artist is through the event system. Basically, you make a "non-random event" that triggers once the wonder is built, one that gives a free great artist.

    Just throwing that out there just in case the code doesn't work. The event system is a greatly underestimated tool for modders, in my opinion.
     
  13. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Alright, I think I may have figured out how to get the code to work, but the problem is that I'm not sure if I can use BUILDINGCLASS_THEATRE or if I have to use BUILDING_THEATRE here. Here is the code:

    Code:
    			<BuildingHappinessChanges>
    				<BuildingHappinessChange>
    					<BuildingType>BUILDING_THEATRE</BuildingType>
    					<iHappinessChange>1</iHappinessChange>              
    			</BuildingHappinessChanges>
    That is what I came up with, and I think it is right, but do you think I could just as easily do this?

    Code:
    			<BuildingHappinessChanges>
    				<BuildingHappinessChange>
    					<BuildingType>BUILDINGCLASS_THEATRE</BuildingType>
    					<iHappinessChange>1</iHappinessChange>              
    			</BuildingHappinessChanges>
     
  14. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Oops, I meant this.

    Code:
    			<BuildingHappinessChanges>
    				<BuildingHappinessChange>
    					<BuildingType>BUILDINGCLASS_THEATRE</BuildingType>
    					<iHappinessChange>1</iHappinessChange>
    				</BuildingHappinessChange>                    
    			</BuildingHappinessChanges>
    And I don't think this is global (i.e. I think it only pertains to the city it is built it), do you know how I could make it so that every city in your Empire enjoys the happiness bonus from theatres?
     
  15. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    @ The_J; I tried out the Flavian Amphitheatre code you gave me, and it didn't work. First it said there was a failure parsing the XML or something. It referred to line 13 of my settings file in the Config folder (CapoSettings.xml) and this is the line:

    Code:
        <gameutils module="DiplomacyGameUtils" class="DiplomacyGameUtils" override="True"/>
    So that was the first thing, and then I got an assert failure, I tried to take a screenshot of it, but when I looked in the screenshots folder it wasn't there, and I already took another screenshot (of the attached image) so it was gone from the clipboard. I already deleted the code from the python so I can recreate it tomorrow or something if you need to see what the assert failure said. But it had something to do with eUnit== something and it was referencing a cpp file (which I didn't alter at all, or even have in my mod so that means the python was wrong I assume).

    Anyway, I set up a game, gave myself the Flavian Amphitheatre and conquered a Zulu city. Now, I did conquer/defeat/kill the Zulu when I did this, so that might be part of it (but even if it is it is no good). Every time I entered the city screen the assert failure came up, the assert failure also came up right after I built the wonder and right after I conquered the Zulu city. For some reason it gave me the option to build any missionary and any executive (see screen). I don't know if any of this information helps at all, but do you think you know what may be causing this?
     
  16. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,774
    Location:
    DE/NL/FR
    For the XML i have no idea, i have not tested it myself.

    Python: No need to repeat it, it's the thing which i expected to crash. Okay, then i have to look at it again.

    :yup: you're right, that also works very good.
     
  17. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Well, I hope you can get this figured out (and the Bamyan Buddhas too). Actually now that I think about it, could the fact that the Bamyan Buddha code didn't work be effecting whether or not the Flavian Amphitheatre code didn't work? Although, if the error you expected to occur with the Flavian Amphitheatre occured, then this is probably not the case.
     
  18. Yxklyx

    Yxklyx King

    Joined:
    May 7, 2008
    Messages:
    869
    Is there a simple mod that just adds one or maybe two new units in between Frigates and Destroyers - maybe making Destroyers come later or something. Simple, not like Wolfshanze's Industrial Mod. Maybe I could just use bits from that Mod?
     
  19. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Youd either have to add new techs and new units, or add new units and push back the Destroyers.
     
  20. GoldenJim

    GoldenJim Chieftain

    Joined:
    Dec 20, 2007
    Messages:
    8
    Does anyone know how to get to change the National Park wonder to get free specialists for all preserves in the rural areas within the cultural boundaries instead of just 1 city's cross?

    If it can't be done, is there anyway to do it for all the cities crosses instead of just1?


    Thanks
     

Share This Page