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. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,676
    Location:
    UK
    no if you have no others changes made to your .dll, then you don't need to do anything with the .dll, just use the 40 civs one. From what I understand JARM has no .dll changes, changing the .dll, requires you to modify the source code and compile a new .dll (there are tutorials for this and it is by no means a 'quick' question :D)

    you can (hopefully) just use winmerge to do the python files from the JARM mod to the 40civs mod.

    Unfortunately I have not worked with either of these so don't know what files are involved..
     
  2. Jaxx

    Jaxx Chieftain

    Joined:
    Jul 25, 2014
    Messages:
    68
    Location:
    Earth
    I have a problem I that have been stuck on for a few days now with my CvTechchooser.py. What I have done was change the size of the tech boxes and now need to change the arrows so they all line up again.

    My Arrows in the tech advisory screen don't line up with the next tech and sometimes the arrow lines go off screen. I believe my problem is in the codes that are below. I'm a noobie with .py files and looked to other CvTechChoser.py and from what I understand that is the problem. When ever I change the math my game crashes so I can not check to see if the arrows are moving or even in the right direction. I am playing with Better BUG AI. I have attached a couple pics and my CvTechChooser.py

    if ( yDiff == -6 ):
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_X, iX + self.getXStart(), iY + self.getYStart(1), self.getWidth(xDiff) / 2, 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_XY, iX + self.getXStart() + ( self.getWidth(xDiff) / 2 ), iY + self.getYStart(1), 8, 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_Y, iX + self.getXStart() + ( self.getWidth(xDiff) / 2 ), iY + self.getYStart(1) + 8 - self.getHeight(yDiff, 0), 8, self.getHeight(yDiff, 0) - 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_XMY, iX + self.getXStart() + ( self.getWidth(xDiff) / 2 ), iY + self.getYStart(1) - self.getHeight(yDiff, 0), 8, 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_X, iX + 8 + self.getXStart() + ( self.getWidth(xDiff) / 2 ), iY + self.getYStart(1) - self.getHeight(yDiff, 0), ( self.getWidth(xDiff) / 2 ) - 8, 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
    screen.addDDSGFCAt( self.getNextWidgetName("TechArrow"), sPanel, ARROW_HEAD, iX + self.getXStart() + self.getWidth(xDiff), iY + self.getYStart(1) - self.getHeight(yDiff, 0), 8, 8, WidgetTypes.WIDGET_GENERAL, -1, -1, False )
     

    Attached Files:

  3. Blitzconfusion

    Blitzconfusion Chieftain

    Joined:
    Jul 30, 2014
    Messages:
    67
    I have been modifying the excelent k-mod to my own needs, including promotions.
    I have noticed, that regardless of my modifications for the Blitz promotion in XML, the promotion does not exist for Units with movement 1 (making the leader promo Morale even more worthless). This is regardless of whether the unit has access to/STARTS WITH a Promotion that increases movement.
    I know that Blitz can indeed be made an available Promotion for Units with movement 1, as it is so in Fall from Heaven 2 (for example: Giant, and pretty much everything else).

    My question is as follows: what files did they modify to enable move 1 Units to feature Blitz on their available Promotions? And further, what other files "check" whether a unit is suitable for a promotion (like Intercept, etc...)?

    I would be gratefull for advice, as this is driving me crazy. Thanks beforehand.

    PS. It is not the file (as far as I can see) that defines max withdrawal and such, as I have modified those files and seen nothing like it for Blitz.
     
  4. Jaxx

    Jaxx Chieftain

    Joined:
    Jul 25, 2014
    Messages:
    68
    Location:
    Earth
    To add Blitz or Intercept to other units you would need to edit the UnitCombatType and put in the type you want to have the promotion available. For example to give Intercept to an animal or archer you would add these lines in CIV4PromotionInfos.xml under PROMOTION_INTERCEPTION1 info.


    <UnitCombat>
    <UnitCombatType>UNITCOMBAT_ANIMAL</UnitCombatType>
    <bUnitCombat>1</bUnitCombat>
    </UnitCombat>
    <UnitCombat>
    <UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
    <bUnitCombat>1</bUnitCombat>
    </UnitCombat>
     
  5. Jaxx

    Jaxx Chieftain

    Joined:
    Jul 25, 2014
    Messages:
    68
    Location:
    Earth
    Hello again. I was following a tutorial which I did not bookmark and can not find now. I downloaded the 2003 tool kit, codeblockers. some lib files and VC 2005, 2008 2010 might be missing a couple others. I'm trying to open the .dll but I can't, but I can look at all the headers and C++ files in the cgamecoredll folder in bts. I haven't changed anything in that but is that just an un complied version of the .dll? or are they 2 different things.

    I really appreciate the help feeling a bit overwhelmed
     
  6. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    There should be a tutorial for at the beginning of the "Civ4 - Modding Tutorials & Reference" sub-section of this forum. It is often the first topic after the sticky topics. I'm sure there are others, but that one by Asaf is pretty much the standard one.

    The files in the CvGameCoreDLL folder are the source for the DLL (well, a few are other things, like the scripting for building it). They are used to make the DLL. You can't really open a DLL file in any way that is useful to most people (even most programmers) as it consists mainly of some data in binary form and the instructions directly used by the CPU (which is basically a series of numbers the CPU understands, meaning things like "do instruction X using the value in register 1 and the value in register 4 and put the result in register 2").

    Visual C++ Express is used to edit the source code - it has features that make this much nicer than doing it with Notepad (or whatever), although you could actually do it that way. Other than that the main thing it is used for is its debugging features, which are a whole other kettle of fish. You only need one version of it (I can verify that the 2008 version works without any additional fiddling beyond what the tutorials I've seen say). The other compiler you install (from 2003ish) is what is actually used to make the DLL from the source code, a procedure which is started from VC++ (so you don't have to run it separately) once it is set up so that it will do that instead of trying to build it itself (compilers newer than that very old one will tend to produce a DLL that is not compatible with the BtS .exe). The thing that controls the build is the file called "Makefile". That file has instructions on how the program is built and it probably needs to be edited to change some definitions near the top of the file so that it can find everything - if you installed everything into default locations there is some slim chance that it will start out correct. There is at least one alternate version of the makefile and related things that keep the definitions in another file (the "Danny Demonic" improved version has all the things you might need to edit in another file called MakefilePaths). Editing this to have the right info should be a step in whatever instructions are are following.

    To get it all to work, you have to follow the instructions carefully. And then not mess up the source code in ways that break everything...

    If you are starting with a mod that has its own DLL it should have the source and makefile stuff available for it (some mods have additional files and therefore need a makefile that knows about them). But before you mess with that, you should make sure you can build the regular BtS DLL since it is the easiest to get working and if you can't build that then you also wont' be able to build the mod's DLL.
     
  7. ThorHammerz

    ThorHammerz zzz

    Joined:
    Jul 31, 2014
    Messages:
    836
    Hi there, couple questions (a bit newb-ish, just started the game/modding a couple weeks back...):

    If I wanted to add a new attribute to a building (such as making all river-adjacent tiles giving me an increased yield - think global levee), beyond adding/modifying the appropriate tags in the XML BuildingSchema and BuildingInfo XML files, what python/C(++?) functions would I need add or modify, and where might I find them?

    If I wanted to allow sea units to be able to attack enemy cities directly (in a similar fashion to helicopters), which function (and where it might be located) would I look for (to clarify, the actual ability/option for ships to attack units inside the city... NOT the city-capture functionality itself)?

    Does the game treat Python files similar to how it treats the XML files? (With regards to reading/loading the "newest" module/file in a mod, overriding whatever default files in the vanilla/BTS assets folder. Do I have to specify the files it needs to look for?).

    If a mod currently has units/buildings/etc XML files modded, but not (for example), the technologies modded, would dropping the technologies .XML file into a new subdirectory (inside the mod's Assets/XML) automatically cause the game to read the file? Or would I have to change something in the DLL for that to happen?

    Thanks!
     
  8. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Adding tags/modifying schemas/Cities attacked by sea units = C++, see post above for compilation of a dll.

    Yes, Python files are treated like XML files, no need to specify, except if you are using BUG as a base.

    New technology file would automatically be read, overriding default one.
     
  9. Ajaccio

    Ajaccio twinArmageddons

    Joined:
    Jun 19, 2012
    Messages:
    40
    Location:
    Pennsylvania, USA
    So I think I'll forgo the whole jarm/40civs thing. I couldn't make any sense of it and I already knew what the python files were, I just didn't know how to include those two python files and merge them with 40civs' dll. I couldnt figure out winmerge.

    However, I would like to know: How do I change the yields (and add commerce yields) of tiles/resources/improvements via Traits and Buildings? I assume this would include a bunch of python editing.
     
  10. ThorHammerz

    ThorHammerz zzz

    Joined:
    Jul 31, 2014
    Messages:
    836
    For buildings, the XML files come with the built-in functions/tags for you to modify river tiles and sea tiles (because Moai Statues/Collawlsus/Levee exist).

    Spoiler :

    <SeaPlotYieldChanges/> #This is currently empty. Would apply effects to sea tiles workable by current city
    <RiverPlotYieldChanges>
    <iYield>0</iYield>
    <iYield>0</iYield>
    <iYield>1</iYield>
    </RiverPlotYieldChanges>
    <GlobalSeaPlotYieldChanges>
    <iYield>0</iYield>
    <iYield>0</iYield>
    <iYield>1</iYield>
    </GlobalSeaPlotYieldChanges>


    Note that the first iYield is for Food, the second is for Hammers, the third is for commerce.

    Any "new" (i.e. not already predefined) functions/tags in the XML would have to be coded through Python/C++, and then implemented in the XML.
     
  11. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Too bad, it is not as difficult as you think it is. Probably there are no clashes between 1) your mod 2) JARM (you can merge xml files like the Religion one) 3) the 50 civs dll.

    Forget the 40civs dll for now as it might have BUG incorporated in the mod which is making your life difficult. The 50 civs dll is an exact replica of the BtS dll but allowing 50 civs instead of 18. It does not require any other setup.

    Just merge your mod with JARM (already done?) and put the 50 Civs dll in the Assets directory of your mod. The Python files go into an Assets/Python/Screens directory as in JARM. Nothing else to merge, just assemble the whole thing in the correct structure, like for any other mod.
     
  12. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    one of the civs in my mod consistently builds attacking stacks with the wrong units. its a Roman civ and they have access to a Legion unit (str 6) but they put Horsemen and Spearmen (str 5 and 4) in the stack with Catapults. the Legion unit has Attack, City Attack and Counter UNIT_AIs. I'd be happy to hard-code them to use the Legions if someone can show me where to look. thanks.
     
  13. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    What are the horse and spear unit ai's, just curious?
     
  14. Ajaccio

    Ajaccio twinArmageddons

    Joined:
    Jun 19, 2012
    Messages:
    40
    Location:
    Pennsylvania, USA
    I am very well aware of that one. I've exhausted all the possibilities with XML though. I want to be able to edit yields to the extent of something similar to civ5.
     
  15. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    spearman
    Default AI: counter, AIs: reserve, counter, city counter, not AIs: none
    horseman
    Default AI: counter, AIs: counter, pillage, not AIs: attack, city attack

    the not AIs for the horseman were my attempt to fix the problem but it doesn't seem to have any effect.
     
  16. Yamato

    Yamato Warlord

    Joined:
    Mar 19, 2006
    Messages:
    100
    I have a question. Sometimes a city name appears in caps with the "TXT_KEY_CITY_NAME etc etc etc."

    A couple of downloaded civs have the problem. The thing is, I can't figure out why. Those city name entries in the info files looks exactly like the entries for cities that appear correctly.
    One example is for the South African's that I believe I took from Civ Gold
    The city is entered as (forgive if the terms are somewhat incorrect, I'm doing this from memory) TXT_KEY_CITY_NAME_OOS_LONDON (either way, its set up exactly, as the the other city names), yet it appears in caps as TXT_KEY_CITY_NAME_OOS_LONDON on the map. In no way does this city (and a couple of others I've come across) appear to be different in its entry in the files, there is no mistake I can find. Anyone else run across this?
     
  17. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,323
    Gender:
    Male
    Location:
    Canberra, Australia
    If your XML files containing the text are in Modules the file name must end with the suffix _CIV4GameText or they will be ignored.

    For example My_Mods_CIV4GameText_Units.XML will be ignored but My_Mods_Units_CIV4GameText.XML will be read and used.

    IIRC All XML files in the XML/Text folder containing text definitions will be read no matter what they are called.
     
  18. Charles555nc

    Charles555nc Prince

    Joined:
    May 3, 2010
    Messages:
    522
    Im playing kmod, is there any way I can make a founding religion show up on a random one of your cities?

    Right now it picks a random city, that is always never your capital. Is there a way I can make it truely random?
     
  19. ThorHammerz

    ThorHammerz zzz

    Joined:
    Jul 31, 2014
    Messages:
    836
    You could always World-Builder it back to your capital :lol:

    The game will:

    - Place a very high emphasis on any and every city that is NOT your capital (by a factor of like 100x or something.....)
    - Prioritize the cities (that are once again, not your capital) that have a higher population. So a pop. 10 will have a greater chance than a pop. 5 city.
    - Prioritize cities that have no religion.

    In other words, if you want to found a religion in your capital, it has to be either your only city. There is a small chance however, that you can found a religion in your capital if you have 2 cities, and you already have the other 6 religions in your 2nd city (but the chance is still rather small :lol:)

    Also, didn't K-Mod implement the new "grip" mechanic that'll kick a religion out (even if it's the holy city...) if the grip isn't strong enough/you have too many religions/population is very small? It'd be funny if a religion got kicked out of its own holy city :lol: (wonder if you'll get the diplo-nuke for it...)

    And yes, it is possible to change the algorithm (using C++ I think?).
     
  20. Zlatko

    Zlatko CIW

    Joined:
    Apr 1, 2010
    Messages:
    713
    Location:
    Solar System

Share This Page