• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

Yeah this one would be a lot more work I think, there is a bit of code in the forums, I forget whether it is python or SDK that allows you to disable religion founding on tech, I think I used that...

then I use this bit of python to found a religion when a building is built, it will not be right for what you need, as it makes the religion of the particular faction, rather than assigning one of 3 to the relevant factions, but it might help you get a little closer...

Code:
  # When capitol is built, found corresponding religion and convert
   def onBuildingBuilt(self, argsList):
      pCity, iBuildingType = argsList
      iCapitol = self.gc.getInfoTypeForString("BUILDING_CAPITOL")
      if iBuildingType != iCapitol: return
      iPlay = pCity.getOwner()
      pPlay = self.gc.getPlayer(iPlay)
      # Perform string operation to get corresponding religion name, eg
      # "TXT_KEY_CIV_HOPEVLLE_DESC" => "RELIGION_HOPEVILLE"
      # For v11, fix bug found by Dresden, v10 feedback thread, post 5
      # Was: sCivdesc = pPlay.getCivilizationDescriptionKey()
      pCiv = self.gc.getCivilizationInfo(pPlay.getCivilizationType())
      sCivdesc = pCiv.getTextKey()
      sReldesc = sCivdesc.replace("TXT_KEY_CIV_", "RELIGION_")
      sReldesc = str(sReldesc.replace("_DESC", ""))
      iRel = self.gc.getInfoTypeForString(sReldesc)
      if iRel != -1:
         CyGame().setHolyCity(iRel, pCity, 1)
         pPlay.convert(iRel)
         furyLog(self.gc.getReligionInfo(iRel).getText() + " founded\n")
      else:
         furyLog("Unable to convert " + sCivdesc + " to religion\n")
 
thanks for helping, it's a good idea to have a religion founded when a building is built, that bypasses the need for the technology and tying the building to that as a prerequisite, provided the building can be made available to more than one but not all civs. The command lines look a bit more complex than what I've been doing so far though, I've not been writing lines out in python. I might see instead of all of this if I can just have a permanent alliance trigger at some point in the game, and rename the religions giving nations favourite religions like "communism" "nazism" to add to the feel of it though them not actually affecting anything.
 
Return means end of story, stop, bye bye.
Thus, when it is not the particular building, all codes below are ignored including movie codes.
It also means it will make merging with other codes in same section difficult
 
Instead of bailing out via "return" if it is not the building being looked for, just do what it does if it is the building being looked for.

Something like this:
Code:
  # When capitol is built, found corresponding religion and convert
   def onBuildingBuilt(self, argsList):
      pCity, iBuildingType = argsList
      iCapitol = self.gc.getInfoTypeForString("BUILDING_CAPITOL")
      [COLOR="DarkRed"][B]if iBuildingType == iCapitol:[/B][/COLOR]
         iPlay = pCity.getOwner()
         pPlay = self.gc.getPlayer(iPlay)
         # Perform string operation to get corresponding religion name, eg
         # "TXT_KEY_CIV_HOPEVLLE_DESC" => "RELIGION_HOPEVILLE"
         # For v11, fix bug found by Dresden, v10 feedback thread, post 5
         # Was: sCivdesc = pPlay.getCivilizationDescriptionKey()
         pCiv = self.gc.getCivilizationInfo(pPlay.getCivilizationType())
         sCivdesc = pCiv.getTextKey()
         sReldesc = sCivdesc.replace("TXT_KEY_CIV_", "RELIGION_")
         sReldesc = str(sReldesc.replace("_DESC", ""))
         iRel = self.gc.getInfoTypeForString(sReldesc)
         if iRel != -1:
            CyGame().setHolyCity(iRel, pCity, 1)
            pPlay.convert(iRel)
            furyLog(self.gc.getReligionInfo(iRel).getText() + " founded\n")
         else:
            furyLog("Unable to convert " + sCivdesc + " to religion\n")
      # whatever comes next
This only runs the code if it is the building being looked for, with the key being the marked line and what it does differently. It does not exit the function if it isn't the building in question, instead it skips over this code and goes on to whatever is after it.

However, if the mod uses BUG and this is being added as a separate event handler in a different file (so no merging and any other event handler for this event will also run) then it doesn't make much difference.
 
CvTopCivs.py in Vanilla (Python/Screens).

Defined for 8 ranks.
 
Hi again. I have two questions:
1. What is CityInfos.xml? I found it inside the GameInfo folder, and it looks like it was made by firaxis and not a mod, and it has three things: CITY_SUBJECT, CITY_INDEPENDENT, and CITY_FREE, and options to change the work rate and stuff like that.
2. How do I get the game years to go from, say, 1925 to 1965 or something?
 
CityInfos.xml must come from a mod, it's not in vanilla, warlords or BtS. I did not check in the official mods.

You say it looks like it comes from Firaxis but it might be misleading as modders often start by copying an existing file and don't bother to change the header.

For the years, it all depends on the settings in the GameSpeedInfo file, see previous page of this thread, zlatko even posted an ERA_CALCULATOR Excel file which helps for this kind of calculation.
 
if anyone is interested I managed to mostly do what I wanted now, but via civics rather than religions. I changed 3 civics to "communism" "nazism" and "capitalism". Made them all available at ASSEMBLY_LINE. Changed the AI favourite civic in the leaderhead infos xml to the relevant one. Then changed the ai "<iFavouriteCivicAttitudeChange> values to be quite extreme. Hopefully that will work and make the game more interesting with historic alliances forming at a certain point in the game!
 
Any one know where I can set up the dates or turn number so that if someone decides to start in a later period than the first, the dates are reasonable?

For example C2C's prehistoric era starts in 50,000 BC. When someone starts in the Ancient era it would be good if the start date was 5,000 BC and 1960 AD if they chose the modern era.
 

Attachments

  • start era.jpg
    start era.jpg
    35.8 KB · Views: 38
Any one know where I can set up the dates or turn number so that if someone decides to start in a later period than the first, the dates are reasonable?

For example C2C's prehistoric era starts in 50,000 BC. When someone starts in the Ancient era it would be good if the start date was 5,000 BC and 1960 AD if they chose the modern era.

In CIV4EraInfos.xml there is a tag called iStartPercent. This is the percent of turns into the game that you will be if you start in that era.

To convert turns to year you need to go though the GameTurnInfos section of the CIV4GameSpeedInfo.xml file to figure out the turn to year conversion for some game speed. It is likely to vary some (or perhaps more than "some") at different game speeds unless they were selected carefully with this sort of thing in mind.
 
You just asked what zlatko asked in previous page :D

No totally different. He was talking about playing from start and getting to classic at the correct date. I am asking how to set the date of turn 1 to the correct date when the player chooses to start in the classic era rather than playing from the start.
 
Nope he was asking the exact same thing and isenchine provided the exact same answer
 
I repeat if I start in the prehistoric period turn 1 = 50,000BC. If I start in the ancient era turn 1 = 5,000BC. If I start in the classical era turn 1 = 500BC. How do I achieve this. At the moment I don't care what turn 2 is.

OK attached are screens of standard BtS ancient and classical starts showing the dates are different. It looks like it is done by setting the turn counter. How is that done?
 

Attachments

  • ancient.jpg
    ancient.jpg
    33.7 KB · Views: 37
  • classical.jpg
    classical.jpg
    66.5 KB · Views: 35
Back
Top Bottom