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

Quick Modding Questions Thread

Discussion in 'Civ4 - Creation & Customization' started by kiwitt, Jan 27, 2010.

  1. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    775
    Location:
    Germany
    Should probably be gc.getTypesEnum("FLAVOR_MILITARY"). getInfoTypeForString is only for enum types with an associated Cv...Info class.
     
  2. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    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: Apr 2, 2020
  3. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    386
    Gender:
    Male
    Location:
    Socially distant
    I love Civfanatics and you. Thank you.
     
    f1rpo likes this.
  4. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    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.
     
  5. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    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: Apr 3, 2020
  6. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    But the nested list you edited is lCityLists? Can you share the error message?
     
  7. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    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.
     
  8. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    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.
     
  9. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    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!
     
    Leoreth likes this.
  10. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    Great! You're welcome.
     
  11. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    386
    Gender:
    Male
    Location:
    Socially distant
    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.
     
  12. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    No, I wished there was one when I started out and I don't think anyone has ever created that.
     
  13. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    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.
     
  14. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,306
    Gender:
    Male
    Location:
    Leblanc
    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.
     
    mysterious_stalker likes this.
  15. mysterious_stalker

    mysterious_stalker Chieftain

    Joined:
    Jan 21, 2018
    Messages:
    77
    That did the trick, thanks!
     
    Leoreth likes this.
  16. Dumanios

    Dumanios MLG

    Joined:
    Oct 24, 2008
    Messages:
    4,882
    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.
     
  17. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    123
    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):
     
  18. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    813
    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.
     
  19. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    123
    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).
     
  20. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,842
    Gender:
    Male
    Location:
    In a constant brainstorm...
    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?
     

Share This Page