Quick Modding Questions Thread

Will gc.getInfoTypeForString("FLAVOR_MILITARY") ever work? Or do I have to use the hardcoded values for flavors like 0,1, etc?
Should probably be gc.getTypesEnum("FLAVOR_MILITARY"). getInfoTypeForString is only for enum types with an associated Cv...Info class.
 
So I've been messing around with RFC RAND's CityNameManager.py
Spoiler Sample civ city names :

Code:
#Babylonia
[[
["Babilû", 90],
["Ninua", 90],
#["Shushan", 90],
["Uruk", 90],#Erech
["Khalpe", 90],
["Kalhu", 90],#Assyrian city of Nimrud.
["Larsa", 90],#Lasar
["Nippur", 90],
["Akkad", 90],#Agade
["Dur Untash", 90],
["Eshnunna", 90],
["Kish", 90],
["Isin", 90],
["Zariqum", 90],
["Opis", 90],
["Borsippa", 90],#Barsippa
["Anatho", 90],
["Sippar", 90],
["Zuruban", 90],
["Cuthah", 90],#Assyrian or Iranian plateau city.
["Mari", 90],#west of original Babylonian power.
["Thapsacus", 90],#tributary from Syria.
["-1", 90],
],[
["Elath", 90],
["Ur", 90],
["Lagash", 90],
["Eridu", 90],
["Kesh", 90],#not the same as Kish
["-1", 90],
],[
["-1", 90],
["-1", 90],
],[
["Raphia", 90],
["-1", 90],
]],
[/SPOILER]
Note that this is the new city name list, which doesn't work. Essentially, I've replaced a name, e.g. "Ur", with a 2-place list.
Similarly, I've edited the implementation in the function, adding a 4th nested list call ([0], since I want it to get the string with the city name) in here:
Spoiler assignName :

Code:
        def getCityListsPointers( self, iCiv, j ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                return scriptDict['lCityListsPointers'][iCiv][j]

        def setCityListsPointers( self, iCiv, j, iNewValue ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                scriptDict['lCityListsPointers'][iCiv][j] = iNewValue
                gc.getGame().setScriptData( pickle.dumps(scriptDict) )




        def assignName(self, city):
                """Names a city depending on its plot"""
                iOwner = city.getOwner()
                if (iOwner < iNumMajorPlayers):
                        #RFCRAND
                        cityX = city.getX()
                        cityY = city.getY()
                        iArea = 0;  # 0 = non-coastal; 1 = coastal; 2 = non-coastal in another continent; 3 = coastal in another continent
                        pCurrent = gc.getMap().plot( cityX, cityY )
                        ownersCapital = gc.getPlayer(iOwner).getCapitalCity()
                        dist = utils.calculateDistance(cityX, cityY, ownersCapital.getX(), ownersCapital.getY())
                        if ((pCurrent.area().getID() != ownersCapital.area().getID() and dist > CyMap().getGridWidth()/8) or dist > CyMap().getGridWidth()/4):
                                iArea = 2
                        if (city.isCoastal(7)):
                                iArea = iArea + 1
                        if (gc.getPlayer(iOwner).getNumCities() == 1 and tForceCapital[iOwner] != -1):
                                iArea = tForceCapital[iOwner]                             
                        #print('iArea', iArea)
                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        #print self.getCityListsPointers(iOwner, iArea)
                      
                        #if empty, check other lists before moving to the random list
                        if (cityName == "-1" and iArea == 0):
                                print('k')
                                iArea = 1
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 2
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 3
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 1):
                                iArea = 0
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 3
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 2
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 2):
                                iArea = 3
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 0
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 1
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 3):
                                iArea = 2
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 1
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 0
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]

                        if (cityName != "-1"):
                                city.setName(cityName, False)
                                self.setCityListsPointers(iOwner, iArea, self.getCityListsPointers(iOwner,iArea)+1)

I have only added the [0] in assignName and converted "city name" to ["city name", 90], 90 being unused as of now. I get a syntax error, though. Can anyone tell me what I've done wrong?
 
Last edited:
Should probably be gc.getTypesEnum("FLAVOR_MILITARY"). getInfoTypeForString is only for enum types with an associated Cv...Info class.

I love Civfanatics and you. Thank you.
 
So I've been messing around with RFC RAND's CityNameManager.py
Spoiler Sample civ city names :

Code:
#Babylonia
[[
["Babil&#251;", 90],
["Ninua", 90],
#["Shushan", 90],
["Uruk", 90],#Erech
["Khalpe", 90],
["Kalhu", 90],#Assyrian city of Nimrud.
["Larsa", 90],#Lasar
["Nippur", 90],
["Akkad", 90],#Agade
["Dur Untash", 90],
["Eshnunna", 90],
["Kish", 90],
["Isin", 90],
["Zariqum", 90],
["Opis", 90],
["Borsippa", 90],#Barsippa
["Anatho", 90],
["Sippar", 90],
["Zuruban", 90],
["Cuthah", 90],#Assyrian or Iranian plateau city.
["Mari", 90],#west of original Babylonian power.
["Thapsacus", 90],#tributary from Syria.
["-1", 90],
],[
["Elath", 90],
["Ur", 90],
["Lagash", 90],
["Eridu", 90],
["Kesh", 90],#not the same as Kish
["-1", 90],
],[
["-1", 90],
["-1", 90],
],[
["Raphia", 90],
["-1", 90],
]],
[/SPOILER]
Note that this is the new city name list, which doesn't work. Essentially, I've replaced a name, e.g. "Ur", with a 2-place list.
Similarly, I've edited the implementation in the function, adding a 4th nested list call ([0], since I want it to get the string with the city name) in here:
Spoiler assignName :

Code:
        def getCityListsPointers( self, iCiv, j ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                return scriptDict['lCityListsPointers'][iCiv][j]

        def setCityListsPointers( self, iCiv, j, iNewValue ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                scriptDict['lCityListsPointers'][iCiv][j] = iNewValue
                gc.getGame().setScriptData( pickle.dumps(scriptDict) )




        def assignName(self, city):
                """Names a city depending on its plot"""
                iOwner = city.getOwner()
                if (iOwner < iNumMajorPlayers):
                        #RFCRAND
                        cityX = city.getX()
                        cityY = city.getY()
                        iArea = 0;  # 0 = non-coastal; 1 = coastal; 2 = non-coastal in another continent; 3 = coastal in another continent
                        pCurrent = gc.getMap().plot( cityX, cityY )
                        ownersCapital = gc.getPlayer(iOwner).getCapitalCity()
                        dist = utils.calculateDistance(cityX, cityY, ownersCapital.getX(), ownersCapital.getY())
                        if ((pCurrent.area().getID() != ownersCapital.area().getID() and dist > CyMap().getGridWidth()/8) or dist > CyMap().getGridWidth()/4):
                                iArea = 2
                        if (city.isCoastal(7)):
                                iArea = iArea + 1
                        if (gc.getPlayer(iOwner).getNumCities() == 1 and tForceCapital[iOwner] != -1):
                                iArea = tForceCapital[iOwner]                            
                        #print('iArea', iArea)
                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        #print self.getCityListsPointers(iOwner, iArea)
                     
                        #if empty, check other lists before moving to the random list
                        if (cityName == "-1" and iArea == 0):
                                print('k')
                                iArea = 1
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 2
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 3
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 1):
                                iArea = 0
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 3
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 2
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 2):
                                iArea = 3
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 0
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 1
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                        elif (cityName == "-1" and iArea == 3):
                                iArea = 2
                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                if (cityName == "-1"):
                                        iArea = 1
                                        cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]
                                        if (cityName == "-1"):
                                                iArea = 0
                                                cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]

                        if (cityName != "-1"):
                                city.setName(cityName, False)
                                self.setCityListsPointers(iOwner, iArea, self.getCityListsPointers(iOwner,iArea)+1)

I have only added the [0] in assignName and converted "city name" to ["city name", 90], 90 being unused as of now. I get a syntax error, though. Can anyone tell me what I've done wrong?
First of all, this isn't your fault but reading Rhye's code makes me sick.

But to summarise, you changed "Uruk" to ["Uruk", 90] and cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)] to cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]? Looks right. What is the syntax error you are getting exactly? It should point you to the actual line at fault.
 
First of all, this isn't your fault but reading Rhye's code makes me sick.

But to summarise, you changed "Uruk" to ["Uruk", 90] and cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)] to cityName = lCityLists[iOwner][iArea][self.getCityListsPointers(iOwner, iArea)][0]? Looks right. What is the syntax error you are getting exactly? It should point you to the actual line at fault.

It's pointing to the line that initiates class CityNameManager. It doesn't really help me in any way, because as you said, it looks right, and I'm really not sure what the problem would be.

To clarify what that class contains, it starts right above my 2nd spoiler in the original post. There are other things inside the class, but I haven't changed any of them.

Spoiler class :

Code:
class CityNameManager:


        def getCityListsPointers( self, iCiv, j ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                return scriptDict['lCityListsPointers'][iCiv][j]

        def setCityListsPointers( self, iCiv, j, iNewValue ):
                scriptDict = pickle.loads( gc.getGame().getScriptData() )
                scriptDict['lCityListsPointers'][iCiv][j] = iNewValue
                gc.getGame().setScriptData( pickle.dumps(scriptDict) )




        def assignName(self, city):
[...]


lCityListPointers is basically a 2-level list like this:
'lCityListsPointers': [[0, 0, 0, 0],
[...]
[0, 0, 0, 0]],
(number of 4-place 0-lists equal to the number of civs it seems)
 
Last edited:
But the nested list you edited is lCityLists? Can you share the error message?
 
But the nested list you edited is lCityLists? Can you share the error message?
Yes, it's indeed lCityLists.
Here's the error log:
Spoiler PythonErr :

Code:
Traceback (most recent call last):
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 1, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvEventInterface", line 13, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvRFCEventManager", line 6, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "CvRFCEventHandler", line 14, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "RiseAndFall", line 11, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 35, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "<string>", line 13, in _get_code
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
  File "
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
CityNameManager
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
", line
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
1698
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
    
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
class CityNameManager: 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
    
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
 
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
^
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
SyntaxError
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
:
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
invalid syntax
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
Failed to load python module CvEventInterface.
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface


Line 1698 is the start of class CityNameManager.
 
How strange. Sometime this means the error is actually in the preceding line, e.g. due to a bracket not being closed. Things like this are easily erased when moving code around. Or maybe there are errors in your indentation?

Usually you do not get a syntax error in the class declaration if there are errors further down in the class. You would get an error at the line where the invalid syntax actually is.
 
How strange. Sometime this means the error is actually in the preceding line, e.g. due to a bracket not being closed. Things like this are easily erased when moving code around. Or maybe there are errors in your indentation?

Usually you do not get a syntax error in the class declaration if there are errors further down in the class. You would get an error at the line where the invalid syntax actually is.

It was. Turns out I was missing a bracket at some point. It was inside the quotes rather than outside (although I have no clue how it happened). Thanks!
 
Great! You're welcome.
 
Anyone know of a documentation for the SDK? Just what each file does. I know the Modiki started on it but it only has like 2 files there.
 
No, I wished there was one when I started out and I don't think anyone has ever created that.
 
Spoiler code snippet :
Code:
[...]

                            playerList = PyGame().getCivPlayerList()
                            #print('playerList', playerList)
                            ctr = 0
                            while ctr != len(playerList):
                                playerList[ctr] = PyPlayer.getID(playerList[ctr])
                                ctr = ctr + 1
                            lMinors = [iIndependent,iIndependent2,iNative,iCeltia,iBarbarian]
                            for x in lMinors:
                                playerList.append(x) #minor civs aren't included so add them
                            print('playerList', playerList)
                            m = 0
                            while m != len(playerList):
                                cityList = PyPlayer(m).getCityList()
                                #print('cityList', cityList)
[...]
So I've been trying to get a list of all cities using PyHelper functions getCivPlayerList, getID and getCityList. The first of these functions only takes into account major civs, so I've attempted to add the constant IDs of minor civs (since in RFC and its modmods, they have fixed IDs). Unfortunately, that does not seem to work. I can get a list with player IDs (the first 4 major civs and the minors, though with duplicates, but that shouldn't really matter at this stage), but I do not seem to be able to get all the cities (and consequently, city names, which is what interests me) owned by the minor and barbarian players. Is it a function limitation to ignore minor civs and the barbarian player? If so, how would I go about changing that? Any help is appreciated.
Also note that I only display the part of the code relevant to this problem. There are no syntax errors.
Spoiler debug log :

[...]
('playerList', [0, 1, 2, 3, 27, 28, 27, 28, 29, 30, 31])
('cityList[e]', u'Niwt-Rst')
('identifier', 'Niwt-Rst')
('cityList[e]', u'Indraprastha')
('identifier', 'Indraprastha')
('cityList[e]', u'Zhongdu')
('identifier', 'Zhongdu')
[...]

That's where the list ends, with cities founded by the other 3 major civs before me. However, cities founded by the minor Independent civs also exist at this point and they are not accounted for.
 
I am not familiar with PyGame.getCivPlayerList, but it seems like it is not suitable to your needs. But if you want to just iterate all players, you can much more easily do something like this:
Code:
for iPlayer in range(gc.getMAX_PLAYERS()):
    print "City list for %s: %s" % (CyGlobalContext().getPlayer(iPlayer).getCivilizationShortDescription(0), PyPlayer(iPlayer).getCityList)
range(n) will give you a sequential list of 0, 1, 2, ..., n-1, e.g. range(3) == [0, 1, 2]. gc.getMAX_PLAYERS() gives you the number of players in the game. If it's an RFC mod, there also should be something like an iNumPlayers constant that is equivalent.

Also you usually do not have to think in list indices, "for x in list" will simply iterate the list one by one and assign its elements to x.

Lastly, the print statement should output things like "City list for Egypt: [u'Niwt-Rst']".

Let me know if you're trying to accomplish something else. But by simply iterating all players yourself, you can skip your issue with minor civs.
 
I am not familiar with PyGame.getCivPlayerList, but it seems like it is not suitable to your needs. But if you want to just iterate all players, you can much more easily do something like this:
Code:
for iPlayer in range(gc.getMAX_PLAYERS()):
    print "City list for %s: %s" % (CyGlobalContext().getPlayer(iPlayer).getCivilizationShortDescription(0), PyPlayer(iPlayer).getCityList)
range(n) will give you a sequential list of 0, 1, 2, ..., n-1, e.g. range(3) == [0, 1, 2]. gc.getMAX_PLAYERS() gives you the number of players in the game. If it's an RFC mod, there also should be something like an iNumPlayers constant that is equivalent.

Also you usually do not have to think in list indices, "for x in list" will simply iterate the list one by one and assign its elements to x.

Lastly, the print statement should output things like "City list for Egypt: [u'Niwt-Rst']".

Let me know if you're trying to accomplish something else. But by simply iterating all players yourself, you can skip your issue with minor civs.

That did the trick, thanks!
 
So I tried to add the Philippines as a civ in my mod and wanted have the Philippines as America's derivative civilization. However, when I try to release a colony as America, I get one of the base game civilizations (khmer, zulu, etc) rather than the Philippines.

I don't know if its something wrong with the XML setup or if its a code peculiarity with Civ 4 or how Civ4 reads Modular files.

Spoiler America XML, check bold :
Code:
        <CivilizationInfo>
            <Type>CIVILIZATION_AMERICA</Type>
            <Description>TXT_KEY_CIV_AMERICA_DESC</Description>
            <ShortDescription>TXT_KEY_CIV_AMERICA_SHORT_DESC</ShortDescription>
            <Adjective>TXT_KEY_CIV_AMERICA_ADJECTIVE</Adjective>
            <Civilopedia>TXT_KEY_CIV_AMERICA_PEDIA</Civilopedia>
            <DefaultPlayerColor>PLAYERCOLOR_BLUE</DefaultPlayerColor>
            <ArtDefineTag>ART_DEF_CIVILIZATION_AMERICA</ArtDefineTag>
            <ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
            <UnitArtStyleType>UNIT_ARTSTYLE_USA</UnitArtStyleType>
            <bPlayable>1</bPlayable>
            <bAIPlayable>1</bAIPlayable>
            <Cities>
                <City>TXT_KEY_CITY_NAME_WASHINGTON</City>
                <City>TXT_KEY_CITY_NAME_NEW_YORK</City>
                <City>TXT_KEY_CITY_NAME_BOSTON</City>
                <City>TXT_KEY_CITY_NAME_PHILADELPHIA</City>
                <City>TXT_KEY_CITY_NAME_ATLANTA</City>
                <City>TXT_KEY_CITY_NAME_CHICAGO</City>
                <City>TXT_KEY_CITY_NAME_SEATTLE</City>
                <City>TXT_KEY_CITY_NAME_SAN_FRANCISCO</City>
                <City>TXT_KEY_CITY_NAME_LOS_ANGELES</City>
                <City>TXT_KEY_CITY_NAME_HOUSTON</City>
                <City>TXT_KEY_CITY_NAME_PORTLAND</City>
                <City>TXT_KEY_CITY_NAME_ST_LOUIS</City>
                <City>TXT_KEY_CITY_NAME_MIAMI</City>
                <City>TXT_KEY_CITY_NAME_BUFFALO</City>
                <City>TXT_KEY_CITY_NAME_DETROIT</City>
                <City>TXT_KEY_CITY_NAME_NEW_ORLEANS</City>
                <City>TXT_KEY_CITY_NAME_BALTIMORE</City>
                <City>TXT_KEY_CITY_NAME_DENVER</City>
                <City>TXT_KEY_CITY_NAME_CINCINNATI</City>
                <City>TXT_KEY_CITY_NAME_DALLAS</City>
                <City>TXT_KEY_CITY_NAME_MEMPHIS</City>
                <City>TXT_KEY_CITY_NAME_CLEVELAN</City>
                <City>TXT_KEY_CITY_NAME_KANSAS_CITY</City>
                <City>TXT_KEY_CITY_NAME_SAN_DIEGO</City>
                <City>TXT_KEY_CITY_NAME_RICHMOND</City>
                <City>TXT_KEY_CITY_NAME_LAS_VEGAS</City>
                <City>TXT_KEY_CITY_NAME_PHOENIX</City>
                <City>TXT_KEY_CITY_NAME_ALBUQUERQUE</City>
                <City>TXT_KEY_CITY_NAME_MINNEAPOLIS</City>
                <City>TXT_KEY_CITY_NAME_PITTSBURGH</City>
                <City>TXT_KEY_CITY_NAME_OAKLAND</City>
                <City>TXT_KEY_CITY_NAME_TAMPA_BAY</City>
                <City>TXT_KEY_CITY_NAME_ORLANDO</City>
                <City>TXT_KEY_CITY_NAME_TACOMA</City>
                <City>TXT_KEY_CITY_NAME_SANTA_FE</City>
                <City>TXT_KEY_CITY_NAME_OLYMPIA</City>
                <City>TXT_KEY_CITY_NAME_HUNT_VALLEY</City>
                <City>TXT_KEY_CITY_NAME_SPRINGFIELD</City>
                <City>TXT_KEY_CITY_NAME_PALO_ALTO</City>
                <City>TXT_KEY_CITY_NAME_CENTRALIA</City>
                <City>TXT_KEY_CITY_NAME_SPOKANE</City>
                <City>TXT_KEY_CITY_NAME_JACKSONVILLE</City>
                <City>TXT_KEY_CITY_NAME_SAVANNAH</City>
                <City>TXT_KEY_CITY_NAME_CHARLESTON</City>
                <City>TXT_KEY_CITY_NAME_SAN_ANTONIO</City>
                <City>TXT_KEY_CITY_NAME_OMAHA</City>
                <City>TXT_KEY_CITY_NAME_BIRMINGHAM</City>
                <City>TXT_KEY_CITY_NAME_HONOLULU</City>
                <City>TXT_KEY_CITY_NAME_ANCHORAGE</City>
                <City>TXT_KEY_CITY_NAME_SACRAMENTO</City>
                <City>TXT_KEY_CITY_NAME_SALT_LAKE_CITY</City>
                <City>TXT_KEY_CITY_NAME_RENO</City>
                <City>TXT_KEY_CITY_NAME_BOISE</City>
                <City>TXT_KEY_CITY_NAME_MILWAUKEE</City>
                <City>TXT_KEY_CITY_NAME_SANTA_CRUZ</City>
                <City>TXT_KEY_CITY_NAME_MONTEREY</City>
                <City>TXT_KEY_CITY_NAME_SANTA_MONICA</City>
                <City>TXT_KEY_CITY_NAME_LITTLE_ROCK</City>
                <City>TXT_KEY_CITY_NAME_COLUMBUS</City>
                <City>TXT_KEY_CITY_NAME_LE_BAM</City>
            </Cities>
            <Buildings>
                <Building>
                    <BuildingClassType>BUILDINGCLASS_SUPERMARKET</BuildingClassType>
                    <BuildingType>BUILDING_AMERICAN_MALL</BuildingType>
                </Building>
            </Buildings>
            <Units>
                <Unit>
                    <UnitClassType>UNITCLASS_MARINE</UnitClassType>
                    <UnitType>UNIT_AMERICAN_NAVY_SEAL</UnitType>
                </Unit>
            </Units>
            <FreeUnitClasses>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_SETTLER</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
            </FreeUnitClasses>
            <FreeBuildingClasses>
                <FreeBuildingClass>
                    <BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
                    <bFreeBuildingClass>1</bFreeBuildingClass>
                </FreeBuildingClass>
            </FreeBuildingClasses>
            <FreeTechs>
                <FreeTech>
                    <TechType>TECH_FISHING</TechType>
                    <bFreeTech>1</bFreeTech>
                </FreeTech>
                <FreeTech>
                    <TechType>TECH_AGRICULTURE</TechType>
                    <bFreeTech>1</bFreeTech>
                </FreeTech>
            </FreeTechs>
            <DisableTechs/>
            <InitialCivics>
                <CivicType>CIVIC_DESPOTISM</CivicType>
                <CivicType>CIVIC_BARBARISM</CivicType>
                <CivicType>CIVIC_TRIBALISM</CivicType>
                <CivicType>CIVIC_DECENTRALIZATION</CivicType>
                <CivicType>CIVIC_PAGANISM</CivicType>
            </InitialCivics>
            <Leaders>
                <Leader>
                    <LeaderName>LEADER_WASHINGTON</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
                <Leader>
                    <LeaderName>LEADER_LINCOLN</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
                <Leader>
                    <LeaderName>WWI_LEADER_USA</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
                <Leader>
                    <LeaderName>LEADER_DEBS</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
                <Leader>
                    <LeaderName>LEADER_FRANKLIN_ROOSEVELT</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
            </Leaders>
            <DerivativeCiv>CIVILIZATION_PHILIPPINES</DerivativeCiv>
            <CivilizationSelectionSound>AS3D_AMERICA_SELECT</CivilizationSelectionSound>
            <CivilizationActionSound>AS3D_AMERICA_ORDER</CivilizationActionSound>
        </CivilizationInfo>

Spoiler Filipino XML :
Code:
<?xml version="1.0"?>
<!-- Sid Meier's Civilization 4 Beyond the Sword -->
<!-- Modified by the Civ Gold Team -->
<!-- Civilization Infos -->
<!-- -->
<Civ4CivilizationInfos xmlns="x-schema:Philippines_CIV4CivilizationsSchema.xml">
    <CivilizationInfos>
        <CivilizationInfo>
            <Type>CIVILIZATION_PHILIPPINES</Type>
            <Description>TXT_KEY_CIV_PHILIPPINES_DESC</Description>
            <ShortDescription>TXT_KEY_CIV_PHILIPPINES_SHORT_DESC</ShortDescription>
            <Adjective>TXT_KEY_CIV_PHILIPPINES_ADJECTIVE</Adjective>
            <Civilopedia>TXT_KEY_CIV_PHILIPPINES_PEDIA</Civilopedia>
            <DefaultPlayerColor>PLAYERCOLOR_PHILIPPINES</DefaultPlayerColor>
            <ArtDefineTag>ART_DEF_CIVILIZATION_PHILIPPINES</ArtDefineTag>
            <ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
            <UnitArtStyleType>UNIT_ARTSTYLE_EUROPEAN</UnitArtStyleType>
            <bPlayable>1</bPlayable>
            <bAIPlayable>1</bAIPlayable>
            <Cities>
                <City>TXT_KEY_CITY_NAME_MANILA</City>
                <City>TXT_KEY_CITY_NAME_QUEZON_CITY</City>
                <City>TXT_KEY_CITY_NAME_KALOOKAN</City>
                <City>TXT_KEY_CITY_NAME_DAVAO</City>
                <City>TXT_KEY_CITY_NAME_CEBU</City>
                <City>TXT_KEY_CITY_NAME_ZAMBOANGA</City>
                <City>TXT_KEY_CITY_NAME_PASIG</City>
                <City>TXT_KEY_CITY_NAME_VALENZUELA</City>
                <City>TXT_KEY_CITY_NAME_LAS_PINAS</City>
                <City>TXT_KEY_CITY_NAME_ANTIPOLO</City>
                <City>TXT_KEY_CITY_NAME_TAGUIG</City>
                <City>TXT_KEY_CITY_NAME_CAGAYAN_DE_ORO</City>
                <City>TXT_KEY_CITY_NAME_PARANAQUE</City>
                <City>TXT_KEY_CITY_NAME_MAKATI</City>
                <City>TXT_KEY_CITY_NAME_BACOLOD</City>
                <City>TXT_KEY_CITY_NAME_DADIANGAS</City>
                <City>TXT_KEY_CITY_NAME_MARIKINA</City>
                <City>TXT_KEY_CITY_NAME_DASMARINAS</City>
                <City>TXT_KEY_CITY_NAME_MUNTINGLUPA</City>
                <City>TXT_KEY_CITY_NAME_ILOILO</City>
                <City>TXT_KEY_CITY_NAME_PASAY</City>
                <City>TXT_KEY_CITY_NAME_MALABON</City>
                <City>TXT_KEY_CITY_NAME_SAN_JOSE_DEL_MONTE</City>
                <City>TXT_KEY_CITY_NAME_BACOOR</City>
                <City>TXT_KEY_CITY_NAME_ILIGAN</City>
                <City>TXT_KEY_CITY_NAME_CALAMBA</City>
                <City>TXT_KEY_CITY_NAME_MANDALUYONG</City>
                <City>TXT_KEY_CITY_NAME_BUTUAN</City>
                <City>TXT_KEY_CITY_NAME_ANGELES</City>
                <City>TXT_KEY_CITY_NAME_TARLAC</City>
                <City>TXT_KEY_CITY_NAME_MANDAUE</City>
                <City>TXT_KEY_CITY_NAME_BAGUIO</City>
                <City>TXT_KEY_CITY_NAME_BATANGAS</City>
                <City>TXT_KEY_CITY_NAME_CAINTA</City>
                <City>TXT_KEY_CITY_NAME_SAN_PEDRO</City>
                <City>TXT_KEY_CITY_NAME_NAVOTAS</City>
                <City>TXT_KEY_CITY_NAME_CABANATUAN</City>
                <City>TXT_KEY_CITY_NAME_SAN_FERNANDO</City>
                <City>TXT_KEY_CITY_NAME_LIPA</City>
                <City>TXT_KEY_CITY_NAME_LAPU_LAPU</City>
            </Cities>
            <Buildings>
                <Building>
                    <BuildingClassType>BUILDINGCLASS_GRANARY</BuildingClassType>
                    <BuildingType>BUILDING_PHILIPPINES_NIPA_HUT</BuildingType>
                </Building>
            </Buildings>
            <Units>
                <Unit>
                    <UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType>
                    <UnitType>UNIT_PHILIPPINES_KATIPUNEROS</UnitType>
                </Unit>
            </Units>
            <FreeUnitClasses>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_SETTLER</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
            </FreeUnitClasses>
            <FreeBuildingClasses>
                <FreeBuildingClass>
                    <BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
                    <bFreeBuildingClass>1</bFreeBuildingClass>
                </FreeBuildingClass>
            </FreeBuildingClasses>
            <FreeTechs>
                <FreeTech>
                    <TechType>TECH_AGRICULTURE</TechType>
                    <bFreeTech>1</bFreeTech>
                </FreeTech>
                <FreeTech>
                    <TechType>TECH_MINING</TechType>
                    <bFreeTech>1</bFreeTech>
                </FreeTech>
            </FreeTechs>
            <DisableTechs/>
            <InitialCivics>
                <CivicType>CIVIC_DESPOTISM</CivicType>
                <CivicType>CIVIC_BARBARISM</CivicType>
                <CivicType>CIVIC_TRIBALISM</CivicType>
                <CivicType>CIVIC_DECENTRALIZATION</CivicType>
                <CivicType>CIVIC_PAGANISM</CivicType>
            </InitialCivics>
            <Leaders>
                <Leader>
                    <LeaderName>LEADER_AGUINALDO</LeaderName>
                    <bLeaderAvailability>1</bLeaderAvailability>
                </Leader>
            </Leaders>
            <DerivativeCiv>NONE</DerivativeCiv>
            <CivilizationSelectionSound>AS3D_AMERICA_SELECT</CivilizationSelectionSound>
            <CivilizationActionSound>AS3D_AMERICA_ORDER</CivilizationActionSound>
        </CivilizationInfo>
    </CivilizationInfos>
</Civ4CivilizationInfos>

I also did some looking at other mods to see how derivative civs worked in general. What I've noticed is that if the Derivative civ points to one of the 34 base BTS civs, it will work as it should - England always releases America, for example. But if the normal derivative already exists or points to a non-base game civ, the derivative civ functions seem to show a strong bias towards the base 34 civs - this is most noticeable in Civ Gold due to the amount of new civs in Civ Gold.
 
Hi,

When working with units which are casting delayed spells (based on FFH), how do you stop the casting early?
The spell prerequisites will be tested when a spell is initially casted. If the situation changes during the delay period, can a spell casting be stopped?

What should I put after this line?
Code:
if pLoopUnit.getDelayedSpell() == gc.getInfoTypeForString (iSpell):
 
If the situation changes during the delay period, can a spell casting be stopped?
If the effect is entirely python, you can put a check at the start of the <PyResult> function, like that:
Code:
def spellInquisition(caster): 
    pPlot = caster.plot() 
    # The city may have been razed while the spell is being cast. 
    if not pPlot.isCity(): 
        return
    [...]
I think it would be a bit more complicated otherwise.
 
Thanks @Ifgr but the pyresult will only be triggered at the end of the delay (some of mine will be quite long), which is why I was hoping to be able to interrupt a casting.

I think I'll just have to invest more time in spell prerequisites and other python permissives (your complicated option).
 
In CIV4CorporationInfo.xml there is the tag <PrereqBonuses> which can contain up to 6 resources but it you add more the just doesn't start.
Anyone knows where this "max 6 resources" limit is defined? Exe, dll or some python file?
 
Back
Top Bottom