Building_FreeUnit - how to add specific CIV


May 3, 2019
Hello. I am sorry if this was discussed somewhere before, i havent found this specific issue.

I am trying to make the Capital spawn additional Settler. I used this command:


This worked perfectly, however, i only wanted to add this to specific CIV. So i added this line:


And the thing does not work. Is there any way to attach <CivType> to <Building_FreeUnits> ??
I cant seem to be able to make this work..

I only want to gain an additional settler after settling the first city for this one specific CIV.

I am very new to modding, honestly just copy/pasting other mods, trying what works.
I saw somwhere, you can create invisible, CIV specific building, but that does not really help since i only want this to happen once in the Capital.

AW Arcaeca

Deus Vult
Mar 10, 2013
Operation Padlock ground zero
Okay. Here is the schema for <Building_FreeUnits>, as defined in the base game files:

<Table name="Building_FreeUnits">
        <Column name="BuildingType" type="text" reference="Buildings(Type)"/>
        <Column name="UnitType" type="text" reference="Units(Type)"/>
        <Column name="NumUnits" type="integer"/>

Do you see a column called CivilizationType in there? Because I do not.

You can't use a column in the table that's not set up to accept it. Regardless of what you think it should do, the fact is that it's basically a syntax error. Essentially everything in the XML files gets translated into SQL by a parser and set off to a database. The parser doesn't know what to do when you give it an order to stuff data into a database column that simply does not exist. It ends up just giving up and discarding the entire file.

You could of course modify the schema to include that column, and that will fix the parsing issue, but it still won't do anything. Column names aren't magic hocus pocus words. They do what they do because somewhere buried deep in the C++ game core, bundled up in the DLL files, abstracted out of view by the higher-level XML, SQL and Lua, something references that column name to tie it to some very specific effect in some very specific context.

That said, the effect you're going for is trivially easy to replicate in Lua:
 function(iPlayer, iX, iY)
    local pPlayer = Players[iPlayer]
    if (pPlayer:GetCivilizationType() ~= GameInfoTypes.CIVILIZATION_MOROCCO) then return end
    local pCity = Map.Plot(iX,iY).GetPlotCity()
    if pCity:IsCapital() then
        pPlayer:InitUnit(GameInfoTypes.UNIT_SETTLER, iX, iY)

You're far more likely to get a timely response from the Civ V Modding Helpline Discord server, by the way.


I've anxiously awaited your arrival!
Mar 9, 2016
The Netherlands
It's also possible to use the <Civilization_FreeUnits> table, as that's where the normal starting settler is provided in the first place. This doesn't grant the settler upon settling your capital city, but that often happens at the start of the game on turn 0 anyways.
Update Civilization_FreeUnits
SET Count = Count + 1

I'm not sure if this change would also affect the number of settlers that Deity AI Players get.
Top Bottom