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. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,016
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Is it possible to make a religion non-selectable as a state-religion in the F7 screen - without editing the dll?
    I know that in DotO civs have forbidden religions...
     
  2. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,708
    Location:
    israel
    hi,
    indeed (original source is Dune Wars).

    i guess its possible from cvreligionscreen.py
    probably need to hard code the religion name .
     
    Zeta Nexus likes this.
  3. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    147
    In FFH, I think religions can be blocked by setting the iWeightModifier in ReligionWeightModifiers value for the particular religion to -100, within CIV4LeaderHeadInfos.xml. That isn't part of BtS but if you're using a mod, it may have been included.
     
    Zeta Nexus likes this.
  4. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,016
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Well, I think I have found the responsible code:
    Code:
            # Convert Button....
            iLink = 0
            if (gc.getPlayer(self.iActivePlayer).canChangeReligion()):
                iLink = 1
    
            if (not self.canConvert(iLinkReligion) or iLinkReligion == self.iReligionOriginal):           
                screen.setText(self.CONVERT_NAME, "Background", self.EXIT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)
                screen.hide(self.CANCEL_NAME)
                szAnarchyTime = CyGameTextMgr().setConvertHelp(self.iActivePlayer, iLinkReligion)
            else:
                screen.setText(self.CONVERT_NAME, "Background", self.CONVERT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CONVERT, iLinkReligion, 1)
                screen.show(self.CANCEL_NAME)
                szAnarchyTime = localText.getText("TXT_KEY_ANARCHY_TURNS", (gc.getPlayer(self.iActivePlayer).getReligionAnarchyLength(), ))
    
            # Turns of Anarchy Text...
            screen.setLabel(self.RELIGION_ANARCHY_WIDGET, "Background", u"<font=3>" + szAnarchyTime + u"</font>", CvUtil.FONT_LEFT_JUSTIFY, self.X_ANARCHY, self.Y_ANARCHY, self.Z_TEXT, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    
        def getReligionButtonName(self, iReligion):
            szName = self.BUTTON_NAME + str(iReligion)
            return szName
    
        def getReligionTextName(self, iReligion):
            szName = self.RELIGION_NAME + str(iReligion)
            return szName
    
        def canConvert(self, iReligion):
            iCurrentReligion = gc.getPlayer(self.iActivePlayer).getStateReligion()
            if (iReligion == gc.getNumReligionInfos()):
                iConvertReligion = -1
            else:
                iConvertReligion = iReligion
    
            return (iConvertReligion != iCurrentReligion and gc.getPlayer(self.iActivePlayer).canConvert(iConvertReligion))       
    
    But since I am still very much a noob for python I don't know how to change it :confused:
    I was searching among mods and modcomps to find something at least a bit similar that would help me to understand things better but I found nothing :sad:
    So if someone could help me I would greatly appreciate it :worship:
     
  5. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    147
    Hi,

    Does anyone know of a good tutorial regarding the creation of new widgets?

    ---

    @Zeta_Nexus
    Try something like this after the iCurrentReligion line,
    Code:
           iCivCannotConvertExampleCiv = gc.getInfoTypeForString('CIVILIZATION_ELOHIM')
           if gc.getPlayer(self.iActivePlayer).getCivilizationType() == iCivCannotConvertExampleCiv:
               return 0
           iCivCannotConverttoSpecificReligion = gc.getInfoTypeForString('CIVILIZATION_LANUN')
           iSpecificBlockedReligion = gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH')
           if gc.getPlayer(self.iActivePlayer).getCivilizationType() == iCivCannotConverttoSpecificReligion and iReligion == iSpecificBlockedReligion:
               return 0
    
    The first three lines would create an agnostic civ, which could not convert to any religion (or are stuck with one if they start the game in a given religion) and something like the last four could be used to block a specific civ from converting to a specific religion.
     
  6. PPQ_Purple

    PPQ_Purple Techpriest Engineer

    Joined:
    Oct 11, 2008
    Messages:
    3,765
    How hard would it be to write up a mapscript that generates a map that's 50% coast (a flat huge square of coastal water) and 50% grassland? Basically I am thinking a map that's half blue and half green.
    Like what would I need to do?
     
  7. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    147
    You could try something like this in the mapscript where plot/terrain types are being set
    Spoiler :

    Code:
       iCoast = gc.getInfoTypeForString('TERRAIN_COAST')
       iGrass = gc.getInfoTypeForString('TERRAIN_GRASS')
       for iX in range(map.getGridWidth()):
           for iY in range(map.getGridHeight()):
               pPlot = map.plot(iX, iY)
               if (iX < (map.getGridWidth()/2)):
                   plotTypes[iY * map.getGridWidth() + iX] = PlotTypes.PLOT_OCEAN
                   pPlot.setTerrainType(iCoast, False, False)
               else:
                   plotTypes[iY * map.getGridWidth() + iX] = PlotTypes.PLOT_LAND
                   pPlot.setTerrainType(iGrass, False, False)
    
     
  8. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    Which python files have to be edited and how can I make corporations auto spread themselves in cities controlled by a defined civ and how can I make corporations disappear if the city is conquered by another civ. If it's too hard to understand what I said here is an example:
    The corporation named Brazilian spices route spreads only to Portuguese cites, if Spain conquers a Portuguese city that has that corporation it disappears.
    Or how can I make corporations be more like in DoC and auto spread themself?
    Thanks for any response!
     
  9. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,474
    Gender:
    Male
    Location:
    House of Hades
    Seems like a DoC specific question? Vanilla BtS has no Python code for that to plug into, you would have to write that from scratch.
     
  10. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    Would the Companies.py work with other mods or does it need some other parts in the RFCUtils or RFCEventHandlr etc...?
     
  11. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,474
    Gender:
    Male
    Location:
    House of Hades
    It uses some event triggered functions, so you need to integrate them into the event handling somehow. I never suggest to blindly copy a DoC file (or any other mod's). Any module comes with dependencies.

    My point is that you can use this file as a starting point to implement something similar (as I did, adapting the code originally from Sword of Islam). If you have specific questions about that particular implementation, it is probably better to ask them in the DoC forum.
     
  12. 5040vision

    5040vision Chieftain

    Joined:
    Oct 25, 2020
    Messages:
    8
    Gender:
    Male
    Doing some minor tweaks on the original Beyond The Sword game. Have figured out quite a lot of things already and really like to discover and figuring things out in the bottom-up approach.

    I have looked around on this forum for quite a while and couldn't find this particular issue and also noticed how a lot of the greater work here seem to have a very top-down approach on things which really doesn't suit me well. However the civfanatics Civ4_Modding_Tutorials have been of great help for me.

    Quick question. How do I change when a bonus resource is revealed. Say for instance if I want Sheep to be revealed when discovering Animal Husbandry for instance?

    At least on my installation there is both an Asset-folder under SMC4Bts AND SMC4Bts/BeyondtheSword with the corresponding XML-files and in some cases I have notice that if a thing is general regardless of expansion, it will not exist in the SMC4Bts/BeyondtheSword-folder and I have to alter it in the SMC4Bts-folder. Had seen that for several other things and I have had no problem figuring it out as I must then change the XML in the SMC4Bts folder. Had worked like a charm. Until this particular thing...

    So with the "when is a bonus resource revealed"-issue, I noticed, that it appears to be no CIV4BonusInfos.xml in the SMC4Bts/BeyondtheSword-folder. However altering in the CIV4BonusInfos.xml to say change <TechReveal>NONE</TechReveal> to <TechReveal>TECH_ANIMAL_HUSBANDRY</TechReveal> will not in fact do the trick as it have done on other things. So is there a place in the SMC4Bts/BeyondtheSword-folder where this can be altered that I somehow have not yet discovered or what's the deal?

    Best Regards
     
    Last edited: Oct 25, 2020
  13. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    To change the bonus reveal tech you should do as you mention above <TechReveal>TECH_WHATEVER</TechReveal>.
    I have no idea what you are talking about when you say SMCBts.
    Do you have the CD or the Steam version?
    Path to Steam version: Program files (x86)/Steam/steamapps/common/Sid Meier's Civilization Beyond the Sword/Beyond the Sword/Assets/XML/Terrain/BonusInfos.xml
    CD Version (not sure if this is correct): 2K Games/Firxis (not sure if this part is correct)/Sid Meier's Civilization Beyond the Sword/Beyond the Sword/Assets/XML/Terrain/BonusInfos.xml.
    Anyway if you are asking where the BonusInfos.xml is, it's not in the Assets folder. You have to copy it from the Warlords folder or Vanilla.
     
  14. 5040vision

    5040vision Chieftain

    Joined:
    Oct 25, 2020
    Messages:
    8
    Gender:
    Male
    Thank you for the quick response.

    Well I am unfortunately running the Steam versions as my older CDs are simply to scratchy from years of playing. I do suspect my folder structure is some weird mess steam have caused over the years. You see on my game I have a folder called Assets under steamapps/common/Sid Meier's Civilization Beyond the Sword as well that seem to be some confusing dinosaur or I don't really get it. Anyway, I currently have no BonusInfos.xml in the folder common/Sid Meier's Civilization Beyond the Sword/Beyond the Sword/Assets/XML/Terrain/ as I assume you suspect I don't. I will try and reinstall the vanilla game and copy the xml-file from there and see if it does the trick.
     
  15. 5040vision

    5040vision Chieftain

    Joined:
    Oct 25, 2020
    Messages:
    8
    Gender:
    Male
    I now tried copying that file, but then it caused an error as it expects the tag iAIObjective after iAITradeModifier instead of iHealth as it is from the vanilla game. So should I copy more xml-files onto the BeyondTheSword-folders to make it work, and if so which ones?

    In the folder /steamapps/common/Sid Meier's Civilization Beyond the Sword/Beyond the Sword/Assets/XML/Terrain/ i now have the following files:

    CIV4BonusInfos
    CIV4FeatureInfos
    CIV4ImprovementInfos
    CIV4TerrainInfos
    CIV4TerrainSchema
     
  16. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    Here let me post the correct file here. But wait a sec because I have to zip it.
     
  17. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    Ok below I attached a zip which contains the CIV4BonusInfos.xml and it won't cause an error if you put it.
     

    Attached Files:

    5040vision likes this.
  18. 5040vision

    5040vision Chieftain

    Joined:
    Oct 25, 2020
    Messages:
    8
    Gender:
    Male
    Thanks. That did the trick! Great help, much appreciated!
     
    Louis the XIV likes this.
  19. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    702
    Gender:
    Male
    Location:
    Court of Versailles
    If you ever need any other help just tell me:)!
     
  20. 5040vision

    5040vision Chieftain

    Joined:
    Oct 25, 2020
    Messages:
    8
    Gender:
    Male
    Thanks again. How about this one. I am wondering where I can alter what tech enables you to trigger production into a commerce. I mean in vanilla music for instance enables you to swap production to culture, alphabet to science etc.

    And also is it possible to set the ratio at how the shields are converted. I am probably looking to get me early access to culture production but with a poor shield to culture ratio (like 25%) giving newly founded cities an additional option to expand their cultural borders early on. Any suggestions?
     

Share This Page