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

Figuring Out Building Creation

Discussion in 'C2C mod mods' started by Squidimp, Apr 13, 2016.

  1. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    As a means of trying my hand at building creation (I have a few wonder ideas I would like to try out) I have been trying to get some vicinity bonus buildings working.
    I am running into two problems, Civpedia text and some other problem associated with the buildinginfos.
    My questions are: -What files should I use to give pedia info (not the CIV4GameText?)?
    -Why is the first building in my list working, but the subsequent ones producing buildinfo errors?
     
  2. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    Almost all the text in the pedia comes from the CIV4GameText. It you are doing a module the file has to have the suffix _CIV4GameText or it will not be read. The buildings have three text tags for example
    Code:
    			<Description>TXT_KEY_BUILDING_PALEOLITHIC_BIRD_MYTH</Description>
    			<Civilopedia>TXT_KEY_BUILDING_ANIMAL_MYTH_PEDIA</Civilopedia>
    			<Strategy>TXT_KEY_BUILDING_ANIMAL_MYTH_STRATEGY</Strategy>
    
    Each of those is defined in the CIV4GameText file.

    I would need to see the XML files to help more.
     
  3. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    It's written like yours, but the pedia shows "TXT_KEY_BUILDING_FOSSIL_HOMINID" and the like instead of the labels in the CIV4GameText XML. And all buildings after the first (Hominid Fossils) fail to load their buildingclass somehow.
    If you want to see the XML code:
    Spoiler :

    <Civ4BuildingClassInfos xmlns="x-schema:C2C_CIV4BuildingsSchema.xml">
    <BuildingClassInfos>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_FOSSIL_HOMINID</Type>
    <Description>TXT_KEY_BUILDING_FOSSIL_HOMINID</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_FOSSIL_HOMINID</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_POTTERY</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_POTTERY</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_POTTERY</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_COINS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_COINS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_COINS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_JEWELERY</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_JEWELERY</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_JEWELERY</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_MEGALITHS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_MEGALITHS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_MEGALITHS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_MICROLITHS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_MICROLITHS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_MICROLITHS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_STATUARY</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_STATUARY</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_STATUARY</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_SWORDS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_SWORDS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_SWORDS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_CROCKERY</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_CROCKERY</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_CROCKERY</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_ARMOUR</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_ARMOUR</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_ARMOUR</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_BURIAL_SITE</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_BURIAL_SITE</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_BURIAL_SITE</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_BEADS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_BEADS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_BEADS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_PIERCINGS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_PIERCINGS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_PIERCINGS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_GLASSWARE</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_GLASSWARE</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_GLASSWARE</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    <BuildingClassInfo>
    <Type>BUILDINGCLASS_ANCIENT_FUNERARY_GOODS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_FUNERARY_GOODS</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iExtraPlayerInstances>-1</iExtraPlayerInstances>
    <bNoLimit>0</bNoLimit>
    <bMonument>0</bMonument>
    <DefaultBuilding>BUILDING_ANCIENT_FUNERARY_GOODS</DefaultBuilding>
    <VictoryThresholds/>
    </BuildingClassInfo>
    </BuildingClassInfos>
    </Civ4BuildingClassInfos>

    Is that useful?
     
  4. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Bugger, I think that was the wrong one. Heres the CIV4BuildingInfos XML
    Spoiler :

    <Civ4BuildingInfos xmlns="x-schema:C2C_CIV4BuildingsSchema.xml">
    <BuildingInfos>
    <BuildingInfo>
    <!-- Dig Site (Hominid Fossils) -->
    <BuildingClass>BUILDINGCLASS_FOSSIL_HOMINID</BuildingClass>
    <Type>BUILDING_FOSSIL_HOMINID</Type>
    <Description>TXT_KEY_BUILDING_FOSSIL_HOMINID</Description>
    <Civilopedia>TXT_KEY_BUILDING_FOSSIL_HOMINID_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_BUILDING_FOSSIL_HOMINID_STRATEGY</Strategy>
    <Advisor>ADVISOR_SCIENCE</Advisor>
    <!-- Graphical and interface -->
    <ArtDefineTag>ART_DEF_BUILDING_FOSSIL_HOMINID</ArtDefineTag>
    <iMinAreaSize>-1</iMinAreaSize>
    <!-- Prerequisites -->
    <PrereqTech>TECH_PALEONTOLOGY</PrereqTech>
    <VicinityBonus>BONUS_ANCIENTTEMPLE</VicinityBonus>
    <PrereqVicinityBonuses>
    <VicinityBonus>BONUS_FOSSIL</VicinityBonus>
    </PrereqVicinityBonuses>
    <!-- Construction cost -->
    <iCost>100</iCost>
    <!-- Main effects -->
    <CommerceChanges>
    <iCommerce>1</iCommerce>
    <iCommerce>2</iCommerce>
    </CommerceChanges>
    <FreeBonus>BONUS_FOSSILS</FreeBonus>
    <iNumFreeBonuses>1</iNumFreeBonuses>
    <!-- Special properties -->
    <iConquestProb>50</iConquestProb>
    <iHurryCostModifier>100</iHurryCostModifier>
    <iAdvancedStartCost>-1</iAdvancedStartCost>
    </BuildingInfo>
    <BuildingInfo>
    <!-- Dig Site (Pottery) -->
    <BuildingClass>BUILDINGCLASS_ANCIENT_POTTERY</BuildingClass>
    <Type>BUILDING_ANCIENT_POTTERY</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_POTTERY</Description>
    <Civilopedia>TXT_KEY_BUILDING_ANCIENT_POTTERY_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_BUILDING_ANCIENT_POTTERY_STRATEGY</Strategy>
    <Advisor>ADVISOR_SCIENCE</Advisor>
    <!-- Graphical and interface -->
    <ArtDefineTag>ART_DEF_BUILDING_ANCIENT_POTTERY</ArtDefineTag>
    <iMinAreaSize>-1</iMinAreaSize>
    <!-- Prerequisites -->
    <PrereqTech>TECH_ARCHEOLOGY</PrereqTech>
    <VicinityBonus>BONUS_ANCIENTTEMPLE</VicinityBonus>
    <PrereqVicinityBonuses>
    <VicinityBonus>BONUS_CLAY</VicinityBonus>
    </PrereqVicinityBonuses>
    <!-- Construction cost -->
    <iCost>100</iCost>
    <!-- Main effects -->
    <CommerceChanges>
    <iCommerce>1</iCommerce>
    <iCommerce>1</iCommerce>
    </CommerceChanges>
    <!-- Special properties -->
    <iConquestProb>50</iConquestProb>
    <iHurryCostModifier>100</iHurryCostModifier>
    <iAdvancedStartCost>-1</iAdvancedStartCost>
    </BuildingInfo>
    <BuildingInfo>
    <!-- Dig Site (Coins) -->
    <BuildingClass>BUILDINGCLASS_ANCIENT_COINS</BuildingClass>
    <Type>BUILDING_ANCIENT_COINS</Type>
    <Description>TXT_KEY_BUILDING_ANCIENT_COINS</Description>
    <Civilopedia>TXT_KEY_BUILDING_ANCIENT_COINS_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_BUILDING_ANCIENT_COINS_STRATEGY</Strategy>
    <Advisor>ADVISOR_SCIENCE</Advisor>
    <!-- Graphical and interface -->
    <ArtDefineTag>ART_DEF_BUILDING_ANCIENT_COINS</ArtDefineTag>
    <iMinAreaSize>-1</iMinAreaSize>
    <!-- Prerequisites -->
    <PrereqTech>TECH_ARCHEOLOGY</PrereqTech>
    <VicinityBonus>BONUS_ANCIENTTEMPLE</VicinityBonus>
    <PrereqVicinityBonuses>
    <VicinityBonus>BONUS_SILVER</VicinityBonus>
    </PrereqVicinityBonuses>
    <!-- Construction cost -->
    <iCost>100</iCost>
    <!-- Main effects -->
    <CommerceChanges>
    <iCommerce>1</iCommerce>
    <iCommerce>1</iCommerce>
    </CommerceChanges>
    <!-- Special properties -->
    <iConquestProb>50</iConquestProb>
    <iHurryCostModifier>100</iHurryCostModifier>
    <iAdvancedStartCost>-1</iAdvancedStartCost>
    </BuildingInfo>

    (It continues, but I think that the spoiler is quite long enough already!)
     
  5. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    It works better if you include the XML in a CODE block/tag inside the spoiler. However it would be even better if you could attach the file. Use "Post Reply" or the "Go Advanced" buttons then "Manage Attachment". The file will need to be compressed.

    It is after midnight here so I will not be able to look at it until the morning as I need sleep.;)

    Edit examining it now. There are no errors in the XML as far as I can see so I am checking it out in game.

    Edit2 works fine in game for me:crazyeye:
     
  6. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Ugh, don't worry, the problem turned out to be stupid folder conflicts caused by my computer :nuke:
     
  7. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    Glad you sorted it out. Looks interesting, hope you will post it when you have it working to your satisfaction.
     
  8. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    I notice that Wonders in the mod now all have a little star in the corner. Is there anywhere I could get this to add to my buttons?
     
  9. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    5,263
    Location:
    Norway
    You need to edit it into the button texture manually.
     
  10. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Is it available as a separate thing? Or should I just photoshop it out of an existing button to put on mine?
     
  11. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    5,263
    Location:
    Norway
    Sparth may have a template, he's the one who added those stars. :)
    It should be easy enough to photoshop out the star anyway.
     
  12. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Yeah, I'll just Photoshop them. Cheers :)
     
  13. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Okay, the XML wonders are coming along nicely.
    I wanted to try some wonders that use a bit of Python, but I can't seem to get it to work. The first is Kirinyaga, a Ngaiism wonder that I want to place some livestock resources around the city, based on the code used by Platyping for the Tsujiki Fish Market.
    The code is here:
    Spoiler :

    from CvPythonExtensions import *
    import CvUtil
    import BugUtil
    import PyHelpers
    import sys

    gc = CyGlobalContext()
    localText = CyTranslator()
    PyPlayer = PyHelpers.PyPlayer
    PyInfo = PyHelpers.PyInfo

    # globals
    ###################################################

    def onBuildingBuilt(argsList):
    'Building Completed'
    pCity, iBuildingType = argsList
    game = gc.getGame()

    ## Kirinyaga Start ##
    if iBuildingType == gc.getInfoTypeForString( 'BUILDING_KRINIYAGA' ):
    iPlayer = pCity.getOwner()
    pTeam = gc.getTeam(gc.getPlayer(iPlayer).getTeam())
    cow = gc.getInfoTypeForString("BONUS_COW")
    sheep = gc.getInfoTypeForString("BONUS_SHEEP")
    pig = gc.getInfoTypeForString("BONUS_PIG")
    past = gc.getInfoTypeForString("IMPROVEMENT_PASTURE")
    iX = pCity.getX()
    iY = pCity.getY()

    pTeam.changeImprovementYieldChange(past, 2, 1)

    for x in range(iX - 2, iX + 3):
    for y in range(iY - 2, iY + 3):
    pPlot = CyMap().plot(x,y)
    if pPlot.isPlayerCityRadius(iPlayer):
    if pPlot.isWater() == -1 and pPlot.getBonusType(-1)== -1:
    randBonus = CyGame().getSorenRandNum(10, "Freebie")
    if randBonus < 2:
    pPlot.setBonusType(cow)
    CyInterface().addMessage(iPlayer,True,20,CyTranslator().getText("TXT_KRINIYAGA_BONUS",(gc.getBonusInfo(cow).getDescription(),)),'',0, gc.getBonusInfo(cow).getButton(),ColorTypes(11), iX, iY, True,True)
    elif randBonus == 2:
    pPlot.setBonusType(sheep)
    CyInterface().addMessage(iPlayer,True,20,CyTranslator().getText("TXT_KRINIYAGA_BONUS",(gc.getBonusInfo(sheep).getDescription(),)),'',0, gc.getBonusInfo(sheep).getButton(),ColorTypes(11), iX, iY, True,True)
    elif randBonus == 3:
    pPlot.setBonusType(pig)
    CyInterface().addMessage(iPlayer,True,20,CyTranslator().getText("TXT_KRINIYAGA_BONUS",(gc.getBonusInfo(pig).getDescription(),)),'',0, gc.getBonusInfo(pig).getButton(),ColorTypes(11), iX, iY, True,True)
    ## Kirinyaga End ##

    def onCityRazed(argsList):
    'City Razed'
    city, iPlayer = argsList
    iOwner = city.findHighestCulture()

    ## Kirinyaga Start ##
    b_Krinigaya = gc.getInfoTypeForString("BUILDING_KRINIYAGA")
    if b_Krinigaya > -1 and city.getNumActiveBuilding(b_Krinigaya) > 0:
    pPlayer = gc.getPlayer(iPlayer)
    pTeam = gc.getTeam(pPlayer.getTeam())
    past = gc.getInfoTypeForString( 'IMPROVEMENT_PASTURE' )

    pTeam.changeImprovementYieldChange(past, 2, -1)
    ## Kirinyaga End ##

    def onCityAcquired(argsList):
    'City Acquired'
    iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
    CvUtil.pyPrint('City Acquired Event: %s' %(pCity.getName()))

    ## Kirinyaga Start ##
    b_Krinigaya = gc.getInfoTypeForString("BUILDING_KRINIYAGA")
    if b_Krinigaya > -1 and pCity.getNumActiveBuilding(b_Krinigaya) > 0:
    pPlayer = gc.getPlayer(iPreviousOwner)
    pPlayer2 = gc.getPlayer(iNewOwner)
    pTeam = gc.getTeam(pPlayer.getTeam())
    pTeam2 = gc.getTeam(pPlayer2.getTeam())
    past = gc.getInfoTypeForString( 'IMPROVEMENT_PASTURE' )

    pTeam.changeImprovementYieldChange(past, 2, -1)
    pTeam2.changeImprovementYieldChange(past, 2, 1)
    ## Kirinyaga End ##

    The bonus to pasture is to tell if the thing is triggering, or something is going wrong later. And nothing is working at all. :blush: So, python modders, what am I missing?
    Does it need something somewhere that tells the game to read it? Do I need to clear the cache before trying new Python things? Please share your wisdom with this young padawan :bowdown:
     
  14. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    Have you told BUG about the python? It is done in the Assets/Config folder. You need an XML file that describes your python to BUG indicating which methods you are using; onBuildingBuilt, onCityRazed and onCityAcquired. Then you need to add a line in the init.xml pointing to this XML file describing your python. There should be one for the example python you used which should give you a start.

    This is how modular python works in BUG. Otherwise all the code would have to be in the one file.

    Again if you post code or XML please include it in the code block # icon or
    Code:
    
    
    or all indentation/formatting is lost making it hard to read. You can still put it all in a spoiler but at least it is readable.
     
  15. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Ah sorry, I forgot about the CODE thing :blush: Turned out that I'd forgotten to put in a config file after updating the init.xml, everything is working now.
     
  16. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    Okay, final question. :shifty:
    I don't suppose there's any way I could give particular units (as in, specific unitclasses) promotions without using unitcombats, is there? AFAIK it can be done with %build speed (as seen in the tar gatherer), but I don't recall seeing it anywhere else in the mod.
    Basically, I would like to give a free promotion to Knights without it affecting all Mounted. I could use Python, obviously, but that would be terrible for the AI. Any thoughts?
     
  17. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    You can make a promotion which can be used by mounted but is not generally available. There are a number of these eg the Religion ones. They can't be selected by the player or AI as part of the unit getting experience.

    Then you can either have a building that provides the promotion to all mounted. Or you can have a special unit that gets the promotion when built, ie it is on the Unit Infos spec. The latter is probably what you want.
     
  18. Squidimp

    Squidimp Apollonian Chthonian

    Joined:
    Oct 29, 2015
    Messages:
    73
    Location:
    Australia
    So it isn't possible to have a building give a particular unit that promotion without applying it to all of a unitcombat (like 'all mounted') or unlocking a new unit (like culture wonders). :think:
    Thanks.
     
  19. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,881
    Gender:
    Male
    Location:
    Canberra, Australia
    Any building can unlock a new unit but they can only give a promotion to a unitcombat.

    Having the building unlock the new unit and having the promotion as a free promotion on this new unit is the way to go.
     
  20. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,748
    Gender:
    Male
    Location:
    Las Vegas

Share This Page