Need help modding worker actions

Borgholio

Chieftain
Joined
Mar 12, 2005
Messages
56
So after many many years of playing Civ 5, I've decided to try my hand at modding a few things here and there that I have found particularly irksome over the ages. The first thing I want to tackle is how automated workers keep spamming trading posts over literally EVERY SINGLE TILE instead of generally more useful improvements like farms or mines. I've tried attacking this from a couple of angles. First thing I tried is to prohibit building trading posts on any tile that wasn't marsh or jungle, but that didn't seem to work. Next thing I tried was a bit simpler, just to prohibit building trading posts on grasslands tiles...but that didn't work either.

Being new to this, I have been using AI to help generate the code. So I'm not sure if it's the AI not doing something quite right or if it's just not possible to mod out the behavior at all. I've pasted a couple of the examples that I've been trying below, if someone could take a quick look and see what I might have been doing wrong that would be a great help. Thanks!


XML file:

<GameData>
<!-- Deletes the rule that allows Trading Posts to be built on Grassland tiles -->
<Delete table="Improvement_ValidTerrains"
ImprovementType="IMPROVEMENT_TRADING_POST"
TerrainType="TERRAIN_GRASS"/>

<!-- Optional: Reduces AI bias towards building TPs globally -->
<Improvements>
<Update>
<Where Type="IMPROVEMENT_TRADING_POST"/>
<Set AIWeight="0"/>
</Update>
</Improvements>
</GameData>



Modinfo file:

<?xml version="1.0" encoding="utf-8"?>
<Mod id="99999999-ABCD-4321-ABCD-000000000001" version="1">
<Properties>
<Name>No Grassland Trading Posts</Name>
<Teaser>Prohibits building Trading Posts on Grassland tiles.</Teaser>
<Description>Automated workers will no longer build or maintain Trading Posts on Grassland.</Description>
<Authors>User</Authors>
<HideSetupGame>0</HideSetupGame>
<AffectsSavedGames>0</AffectsSavedGames>
<SupportsSinglePlayer>1</SupportsSinglePlayer>
</Properties>
<Files>
<File import="0">Database.xml</File>
</Files>
<Actions>
<OnModActivated>
<UpdateDatabase>Database.xml</UpdateDatabase>
</OnModActivated>
</Actions>
</Mod>
 
This should be the correct syntax to delete the row

XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 1/2/2026 10:35:04 PM -->
<GameData>
    <Improvement_ValidTerrains>
        <Delete ImprovementType="IMPROVEMENT_TRADING_POST" TerrainType="TERRAIN_GRASS"/>
    </Improvement_ValidTerrains>
</GameData>

As for the second part, there is no AIWeight in the Improvements table
 
Thanks! What would be the syntax to restrict trading posts to only tiles that had Jungles or Marshes on them? Here is what I currently have, is this correct? Or would I need to delete the individual feature types instead of the entire table?



<GameData>

<Delete table="Improvement_ValidTerrains" ImprovementType="IMPROVEMENT_TRADING_POST"/>

<Delete table="Improvement_ValidFeatures" ImprovementType="IMPROVEMENT_TRADING_POST"/>

<Improvement_ValidFeatures>
<Row>
<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
<FeatureType>FEATURE_JUNGLE</FeatureType>
</Row>
<Row>
<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
<FeatureType>FEATURE_MARSH</FeatureType>
</Row>
</Improvement_ValidFeatures>

</GameData>
 
I don't understand why Improvement_ValidFeatures doesn't have rows for Trading Post :think: ?

1767392278155.png


It's one of the few improvements that don't remove the jungle
 
I think I managed to get it. This prohibits workers from building trading posts on anything that isn't a jungle or marsh. Thanks for your help, you pointed me in the right direction! :)




<GameData>

<Improvement_ValidTerrains>
<Delete ImprovementType="IMPROVEMENT_TRADING_POST"/>
</Improvement_ValidTerrains>


<Improvement_ValidFeatures>
<Row>
<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
<FeatureType>FEATURE_JUNGLE</FeatureType>
</Row>
<Row>
<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
<FeatureType>FEATURE_MARSH</FeatureType>
</Row>
</Improvement_ValidFeatures>



</GameData>
 
Back
Top Bottom