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

Specific modifications to LoR - making sure these are possible

Discussion in 'Civ4 - Creation & Customization' started by HunterC, Sep 2, 2012.

  1. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    I want to do the following modifications and I think I can probably do them pretty easily via the xml files, but wanted to see what everyone else thought:

    1. Bldg founds religion - whoever builds wonder X first will be the founder of X religion

    2. Make it so that there are no 2 religions in any city, i.e., a 2nd religion can't join the city. There's a civic that makes it so that no non-state religion spreads... but I want to make this a fact even without having to have that civic. Once a religion is in a city, that religion sticks.

    3. Defense bonuses are calculated by population or is a function of population

    4. Cannot build city on a tile that has a resource (whether visible or hidden)

    5. Tiles improve as a function of technology

    6. Buildings and units can be unique for multiple countries... e.g., the Hwacha is unique to Korea AND Japan

    Are any of these too crazy? Do you think I would need to get into the python code for any of them? If I do have to do the python code, does that require recompiling anything (I'm more comfortable with editing the XML code).

    thanks!
     
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Besides 6, none of them is possible via pure XML.
    Python does not need compiling, SDK does
     
  3. The_guy

    The_guy Elephantary School.

    Joined:
    Nov 23, 2010
    Messages:
    64
    Location:
    Holland.
    Actually, I just tested, and 1 is possible in XML too. Just set it to spread the religion it is for, and it will found that religion.
     
  4. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    You will get the Founded Movie, but the religion is still not founded.
    The city itself will not be the holy city and neither is it stated in the religion advisor.
     
  5. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    916
    This is done in Gods of old. See Python/CvEventManager.py at line ~870.
    This is possible via python callback.
    SDK (I believe)
    python callback
    Do you have an example how this should work?
    XML. Just add them in Civ4CivilzationInfos.xml to the <Buildings> Tag.

    So most of your wishes can be done via python and without compiling. Do you have programming experience? If yes, python should not be a big hurdle.
     
  6. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    For number 5, you can't do the base tiles improving via XML but you can have improvements improve. You can make more (or all) of them get upgrades when worked like cottage->hamlet and/or you can give the improvements direct increases from techs, like how farms get +1 food from biology or workshops get +1 production from guilds and again from chemistry, via the TechYieldChanges section of the improvement XML. LoR already gives a few more tech related bonuses than regular BtS, but not a lot.

    Also, for number 2 you should realize that there is no civic property that stops non-state religions from spreading to cities. There is one that stops the natural spread of anything but the state religion and prevents missionaries controlled by other players from spreading the other religions, but the player that owns the city can always spread any religion to that city using a missionary (thus the common tactic of gifting a missionary to an AI running Theocracy to get your religion into one of their cities).
     
  7. The_guy

    The_guy Elephantary School.

    Joined:
    Nov 23, 2010
    Messages:
    64
    Location:
    Holland.
    Ah, wups. Concluded too quickly there.
     
  8. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    1. Bldg founds religion - whoever builds wonder X first will be the founder of X religion

    I found the part in Gods of Old that you're referring to (below) but I'm not understanding what I would change to make it so that if Civ A built Wonder 1, Civ A then becomes the founder of X religion. The code looks like it defines which religion is founded if X shrine is built.


    Code:
    def onBuildingBuilt(self, argsList):
    		'Building Completed'
    		pCity, iBuildingType = argsList
    		game = gc.getGame()
    		if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) and isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())):
    			# If this is a wonder...
    			popupInfo = CyPopupInfo()
    			popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
    			popupInfo.setData1(iBuildingType)
    			popupInfo.setData2(pCity.getID())
    			popupInfo.setData3(0)
    			popupInfo.setText(u"showWonderMovie")
    			popupInfo.addPopup(pCity.getOwner())
    		CvAdvisorUtils.buildingBuiltFeats(pCity, iBuildingType)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_KI_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_KI")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_ENKI_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_ENKI")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_ENLIL_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_ENLIL")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_INANNA_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_INANNA")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_NANNA_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_NANNA")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_UTU_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_UTU")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_AN_SHRINE"):
    			iReligion = CvUtil.findInfoTypeNum(gc.getReligionInfo, gc.getNumReligionInfos(), "RELIGION_AN")
    			gc.getGame( ).setHolyCity(iReligion, pCity, 1)
    
    		if (not self.__LOG_BUILDING):
    			return
    		CvUtil.pyPrint('%s was finished by Player %d Civilization %s' 
    			%(PyInfo.BuildingInfo(iBuildingType).getDescription(), pCity.getOwner(), gc.getPlayer(pCity.getOwner()).getCivilizationDescription(0)))
     
  9. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    2. Make it so that there are no 2 religions in any city, i.e., a 2nd religion can't join the city. There's a civic that makes it so that no non-state religion spreads... but I want to make this a fact even without having to have that civic. Once a religion is in a city, that religion sticks.

    Do you know which file I should look in to do this python callback?
     
  10. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    The code is very simple, when a shrine is built, set the city as its holy city.
    Since you can only build stuff in your own city, obviously whoever built it found the religion
     
  11. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    CvGameUtils.
    There should be a section that about no religion spreading
     
  12. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    Great... two questions down, and now a few more if anyone has any ideas:

    1. I know that disabling tech trading is a toggle, but is there a way to disable trading of resources?

    2. I want to control the bonus (how much gold, food, hammers produced) a tile gets when it's the city tile ... is it possible?

    Thanks!
     
  13. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,974
    Location:
    DE/NL/FR
    Don't think 1 is possible, unless you make Dll modifications.
    Same for 2, since you just get everything from the base tile which exceeds 2/1/1.
     
  14. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston

    True, but can you change that? For example, 3 food, 5 shields, 3 gold or something else that I set?
     
  15. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    1. I know that disabling tech trading is a toggle, but is there a way to disable trading of resources?

    I'm going to take a look at the tutorial on compiling the DLL... so if I'm willing to tackle the DLL, does anyone have any ideas of the code I'd modify for disabling the trading of resources?
     
  16. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,974
    Location:
    DE/NL/FR
    ...er...if you want to have that for every city tile...then sure.
    It's in Terrain\YieldInfos.xml (it's a vanilla file).
     
  17. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    Awesome, thanks!!
     
  18. HunterC

    HunterC Chieftain

    Joined:
    Sep 2, 2012
    Messages:
    24
    Location:
    Boston
    In starting to do the modding for this, I'm realizing it's not going to do what I was looking for.

    I'd like to make it so that instead of a PrereqTech founding a religion, I'd like it to be a prereq building. This example won't make realistic sense, but for instance, I'd like to make it so that only 2 or 3 civs can make building X (e.g., a library) and the first civ to make that building, founds Y religion (Christianity). In other words, building a Library founds Christianity.

    I get how to make it so that a building is unique to 2 or 3 civs, but I'm having a hard time figuring out how to make it so that a building can found a religion.

    The code from Gods of Old doesn't do it because in order to build a shrine, the religion already exists.

    thanks for any ideas.
     
  19. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,974
    Location:
    DE/NL/FR
    If your only problem is to make a building found a religion, then this can be solved with 2 lines of Python code.
    If you need an example...
     
  20. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    You know... If the code from GoO tells you build a shrine and the religion is founded and set as holy city, and you are complaining that this code cannot work for you, because to build a shrine, the religion has to be exist...

    Then isn't it simple just to:
    1) Replace the shrine with any other building which DOES NOT require the religion. If the building is world wonder where only 1 can be built, no further codes adjustments required beside the variable.
    If it is some common building like Granary or Library, then yeah some codes adjustments necessary to make sure only the first one triggers the codes.

    Else:
    2) Just go and do simple XML adjustments and set it such that the shrine does not need the religion to be built...

    Tada, solved
     

Share This Page