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

How to disable settlers from being bought and produced?

Discussion in 'Civ5 - Creation & Customization' started by Xiomn, May 6, 2020.

  1. Xiomn

    Xiomn Chieftain

    Joined:
    May 6, 2020
    Messages:
    13
    Gender:
    Male
    I want to limit all AI Civilisations to 3 cities.

    I have edited the in-game files making it so each Civ starts with three settler units.

    The next step would be to make it so neither myself nor any AI can product or buy any further settlers.


    In order to attempt to do this I have also edited the CIV5Units .XML file and in the settlers section I have included the new line and i have also changed the following line

    (See highlighted colours below).

    However, when starting a new game to test whether I can still produce another settler, it is still possible when theoretically it shouldn't be? (Ancient Era, Community Patch).

    I have also tried putting the values at super high values to effectively achieve the same effect, again with no success.

    Can anyone help me out?

    Row>
    <ID>0</ID>
    <Class>UNITCLASS_SETTLER</Class>
    <Type>UNIT_SETTLER</Type>
    <Cost>-1</Cost>
    <Moves>2</Moves>
    <Capture>UNITCLASS_WORKER</Capture>
    <CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH_EARLY_GAME_ONLY</CivilianAttackPriority>
    <HurryCostModifier>-1</HurryCostModifier>
    <Domain>DOMAIN_LAND</Domain>
    <DefaultUnitAI>UNITAI_SETTLE</DefaultUnitAI>
    <Description>TXT_KEY_UNIT_SETTLER</Description>
    <Civilopedia>TXT_KEY_CIV5_ANTIQUITY_SETTLER_TEXT</Civilopedia>
    <Strategy>TXT_KEY_UNIT_SETTLER_STRATEGY</Strategy>
    <Help>TXT_KEY_UNIT_HELP_SETTLER</Help>
    <Requirements>TXT_KEY_NO_ACTION_SETTLER_SIZE_LIMIT_HARDCODED</Requirements>
    <Food>true</Food>
    <Found>true</Found>
    <CombatLimit>0</CombatLimit>
    <UnitArtInfo>ART_DEF_UNIT__SETTLER</UnitArtInfo>
    <UnitArtInfoCulturalVariation>true</UnitArtInfoCulturalVariation>
    <PortraitIndex>0</PortraitIndex>
    <IconAtlas>UNIT_ATLAS_1</IconAtlas>
     
  2. TopHatPaladin

    TopHatPaladin Warlord

    Joined:
    Nov 5, 2017
    Messages:
    123
    Gender:
    Male
    Location:
    New England
    Since the Settler's production cost seems to be defined outside of the standard Cost row in the database, your best bet is probably to use Lua to prevent Settlers from being trained. Try creating a Lua file in your project that includes this code:

    Code:
    local iSettler = GameInfoTypes["UNIT_SETTLER"]
    
    function PreventSettlerTraining(playerID, unitType)
        if unitType == iSettler then
            return false
        end
        return true
    end
    GameEvents.PlayerCanTrain.Add(PreventSettlerTraining)
     
  3. Xiomn

    Xiomn Chieftain

    Joined:
    May 6, 2020
    Messages:
    13
    Gender:
    Male

    I don't know anything about Lua or how to go about doing this, but I'll find out how to do it somehow.. I'm in the mod buddy right now, created an empty mod and have created a new project and selected create lua script, do I just copy the above script you posted word for word?
     
  4. Progenitor Race

    Progenitor Race Chieftain

    Joined:
    Jul 7, 2018
    Messages:
    41
    Like an option, it is possible to make a tech prerequisition for settlers, and make this tech restricted for research.
     
  5. Xiomn

    Xiomn Chieftain

    Joined:
    May 6, 2020
    Messages:
    13
    Gender:
    Male
    Ideally I would need some super cool person to run me through it step by step.. I would very grateful as this is the last thing that would literally make me happy as ever to play Civ5. Without it, I don't really feel like playing it.

    I've copy and pasted the code the other poster put into new project/mod.. but don't know what I am doing next at all.
     
  6. TopHatPaladin

    TopHatPaladin Warlord

    Joined:
    Nov 5, 2017
    Messages:
    123
    Gender:
    Male
    Location:
    New England
    Yup!

    To get the Lua code to run, you'll need to set the file to InGameUIAddin in Modbuddy; whoward has a tutorial on how to do that, which phrases it more effectively then I'd be able to myself.
     
  7. Xiomn

    Xiomn Chieftain

    Joined:
    May 6, 2020
    Messages:
    13
    Gender:
    Male
    Got it to work. This should work for AI as well as me, the player, too right? If so thank you so much for your help.. might actually be able to enjoy playing Civ 5 scenarios as I want to play them without inundated AI city spam.. hopefully. We'll see.
     
    Last edited: May 7, 2020

Share This Page