CrimsonEmperor
Chieftain
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?
Thank you sir.
EDIT: Although Tsentom1's Flavian Amphitheatre says "Can capture enemy UBs" I want you to have the ability to build enemy UUs in cities you conquer. Which is slightly different than capturing the UB, in fact you can't really capture an enemy UU when you conquer a city at all.
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?
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
## 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 ##
## 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 ##
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?
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.
def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = 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 )
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.
<BuildingHappinessChanges>
<BuildingHappinessChange>
<BuildingType>BUILDING_THEATRE</BuildingType>
<iHappinessChange>1</iHappinessChange>
</BuildingHappinessChanges>
<BuildingHappinessChanges>
<BuildingHappinessChange>
<BuildingType>BUILDINGCLASS_THEATRE</BuildingType>
<iHappinessChange>1</iHappinessChange>
</BuildingHappinessChanges>
<BuildingHappinessChanges>
<BuildingHappinessChange>
<BuildingType>BUILDINGCLASS_THEATRE</BuildingType>
<iHappinessChange>1</iHappinessChange>
</BuildingHappinessChange>
</BuildingHappinessChanges>
<gameutils module="DiplomacyGameUtils" class="DiplomacyGameUtils" override="True"/>
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.
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?