Quick Modding Questions Thread

What xml file would I add this to in BTS? There are multiple possibilities... gametext_bts_fixed, patched, etc. Whenever I alter a gametext file I generate an error in loading such that even deleting the entry does not fix it... I have to copy over the file I was working on with my saved copy...

<TEXT>
<Tag>TXT_KEY_UNIT_ANGLO_SAXON_HUSCARL_STRATEGY</Tag>
<English>A unit with a strategy.</English>
<French>in French</French>
<German>in German</German>
<Italian>in Italian</Italian>
<Spanish>in Spanish</Spanish>
</TEXT>
 
Craig_Sutter: Any XML file located in the text folder is kosher, at least as far as I understand. So you might just make your own if you like - they are all read on initialization.

Your error might have to do with text encoding. Check what encoding was used originally and what encoding you used when saving.
 
Is there a way to stop an a land unit being airlifted?
 
Is there a way to stop an a land unit being airlifted?

Don't think so.
There might be a chance to modify...er...canPickPlot in...not sure there, to return false when the mission is airlifting, but i'd not bet on that.
 
I know that city population is calculated in CvCity.cpp. But where is calculated civs population? I want to change it from a sum of all cities population into ~ all cities population*(1+ %ofControlledLandmass*200/numofCities). How?

[EDIT]: I think I find it in CvPlayer.cpp but still don't know how to change it:
Spoiler :
Code:
long CvPlayer::getRealPopulation() const
{
    CvCity* pLoopCity;
    __int64 iTotalPopulation = 0;
    int iLoop = 0;

    for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
    {
        iTotalPopulation += pLoopCity->getRealPopulation();
    }

    if (iTotalPopulation > MAX_INT)
    {
        iTotalPopulation = MAX_INT;
    }

    return ((long)(iTotalPopulation));
}

Anyone? I think I need just a function to get the number of cities and another for % of controlled landmass and simple * and + will make it. Nevertheless I'm unable of finding them and checking if my idea is correct.
 
Anyone? I think I need just a function to get the number of cities and another for % of controlled landmass and simple * and + will make it. Nevertheless I'm unable of finding them and checking if my idea is correct.

I think this might do it:
Spoiler :
Code:
long CvPlayer::getRealPopulation() const
{
    CvCity* pLoopCity;
    __int64 iTotalPopulation = 0;
    int iLoop = 0;

    for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
    {
        iTotalPopulation += pLoopCity->getRealPopulation();
    }

[COLOR="Red"]
    iTotalPopulation = iTotalPopulation * (1 + getTotalLand() / std::max(1, GC.getMapINLINE().getLandPlots()) * 200 / getNumCities())
[/COLOR]

    if (iTotalPopulation > MAX_INT)
    {
        iTotalPopulation = MAX_INT;
    }

    return ((long)(iTotalPopulation));
}
 
I'd like to modify Aggressive to give Combat I to all Assault units (Grenadiers, Marines, Paratroopers) and Protective to give Combat I and City Garrison I to all Polearm units (Spearmen, Pikemen). How do I do this?
 
Jarlaxe Baenre, your encyclopedic knowledge of the XML never ceases to amaze me. :king: I'm so gonna ask you once I need to get some proper modding done... :D (As you probably know I'm only doing scripting at this point. Don't hesitate to ask if you need some Python work, by the way. Did you ever get those Huns of yours to behave?)
 
Civilization IV/Warlords/XML/Civilizations/TraitInfos.xml

No wonder I couldn't find it. I was only looking in civ4/bts/assets/xml...

This will earn you a second mention in the "thanks & credits" file.
 
I use the project files attached to search in the game's XML and python files.

If you work with Visual Studio you can use these projects to easily find stuff.
(You can download VS express for free - these files are VS 2005 files, but they can be converted to newer versions)

Place the BTS project files in the appropriate assets folder (the XML projects in the Assets\XML folder and the python in the python), and then you can search the project files from within the VS (Find In Files, or Ctrl+Shift+F).
(The warlords and vanilla of course go to their appropriate Assets folder).

Just be careful not to edit anything by mistake (I remember seeing somewhere the tip that you can make the files read only. Don't remember who wrote it). If you want you can copy the XML and Python assets folders to a different location.

I separated the Text XML files from the other files since they have too much text and they make the results much harder to read.

You can make a single solution which holds all projects (Vanilla, Warlords, BTS), so you can search them all together (just keep the text project apart).

Hope that helps anyone :)
 

Attachments

Thanks Asaf that will come in handy.
 
Okay, new question: how would I go about changing the prerequisites for terrain improvements? I'd like Oil Wells to be available with Engineering, rather than Combustion, but I'm not finding anything useful in CIV4BonusInfos.xml, CIV4ImprovementInfos.xml, or CIV4TechInfos.xml
 
Okay, new question: how would I go about changing the prerequisites for terrain improvements? I'd like Oil Wells to be available with Engineering, rather than Combustion, but I'm not finding anything useful in CIV4BonusInfos.xml, CIV4ImprovementInfos.xml, or CIV4TechInfos.xml

CIV4BuildInfos.xml
 
Back
Top Bottom