Trying to mod Trading Posts

Grunthex

Prince
Joined
Oct 21, 2001
Messages
366
Location
Calgary, Canada
Looking for a bit of advice. Seems to me my logic is solid, but I can't make it work in practice.

I'm trying to make trading posts so they can only be built on a road or railroad, or on a riverside.

Using the Lumbermill as inspiration, I dove into Terrain\Civ5Improvements.xml

In that file, Lumbermills are not defined anywhere in Improvement_ValidTerrains, but they are defined in Improvement_ValidFeatures. As we know, in practice lumbermills get to be built on any forest, regardless of the terrain underneath.

So in the Improvement_ValidFeatures table, I've tried adding the following:
Code:
<Row>
			<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
			<FeatureType>ROUTE_ROAD</FeatureType>
		</Row>

I've also tried:
Code:
<Row>
			<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
			<FeatureType>FEATURE_RIVER</FeatureType>
		</Row>

And just for kicks I tried both. None of it seems to work. All I've accomplished is to disable trading posts entirely. Anyone have any thoughts?
 
*Disclaimer little modding skills*

Is there a way to specify an improvement type instead of a "feature" type? Roads aren't technically features and the "featuretype" might only refer to terrain features. That being said why rivers don't work is beyond me.
 
did you also add this;
Code:
                <Row>
			<Type>IMPROVEMENT_TRADING_POST</Type>
			<Description>TXT_KEY_IMPROVEMENT_TRADING_POST</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TRADING_POST_TEXT</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_TRADING_POST</ArtDefineTag>
                        [COLOR="Blue"]<RequiresFeature>true</RequiresFeature>[/COLOR]
			<PillageGold>20</PillageGold>
			<PortraitIndex>32</PortraitIndex>
			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
		</Row>
?? its in the improvements.xml, the lumbermill has the same, optional tag
 
did you also add this;
Code:
                <Row>
			<Type>IMPROVEMENT_TRADING_POST</Type>
			<Description>TXT_KEY_IMPROVEMENT_TRADING_POST</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TRADING_POST_TEXT</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_TRADING_POST</ArtDefineTag>
                        [COLOR="Blue"]<RequiresFeature>true</RequiresFeature>[/COLOR]
			<PillageGold>20</PillageGold>
			<PortraitIndex>32</PortraitIndex>
			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
		</Row>
?? its in the improvements.xml, the lumbermill has the same, optional tag

I hadn't added that, thanks for the idea! But unfortunately it didn't work.

In the interest of trying everything, and based on the point by Paasky that roads may not be considered a feature (as they're defined as Routes), I tried creating a Table called Improvement_ValidRoutes and putting the road stuff there, but still no go.

I also looked in some of the other tags, and found one in the farm entry called <FreshWaterMakesValid> ... that didn't work either.

Still stumped!
 
Did you look at the valid terrain section of the xml? Line 385. Or the valid features section at 571? It looks like, because of the new database system (I guess?), some of the information is set up. So you might have to mark "featuremakesvalid" as true in the main trade post area and then go down to 571 to specify the feature that actually makes it valid.

On that note I see no way of making the trade posts run along roads because there is no "improvementmakesvalid" in the code as far as I can see. Might have to wait until ModBuddy comes out to mess with lau or C++ to make that.
 
I know one of the building you can build in a city requires there to be a tile adjacent to a river, maybe you can see what it has in its tags. I want to say it is a watermill building IIRC. In the meantime I will try to find it and post if I find it to help ya out.

Well I found it pretty fast.

- <Row>
<Type>BUILDING_WATERMILL</Type>
<BuildingClass>BUILDINGCLASS_WATERMILL</BuildingClass>
<Cost>120</Cost>
<GoldMaintenance>2</GoldMaintenance>
<PrereqTech>TECH_THE_WHEEL</PrereqTech>
<Description>TXT_KEY_BUILDING_WATERMILL</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_WATERMILL_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_WATERMILL_STRATEGY</Strategy>
<Help>TXT_KEY_BUILDING_WATERMILL_HELP</Help>
<ArtDefineTag>ART_DEF_BUILDING_WATERMILL</ArtDefineTag>
<River>true</River>
<MinAreaSize>-1</MinAreaSize>
<ConquestProb>66</ConquestProb>
<HurryCostModifier>25</HurryCostModifier>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>29</PortraitIndex>
</Row>
 
"RiverSideMakesValid". Make that true and see what it does. (Line 16 of civ5 improvements) Should be able to just stick that under trade post and it will be river only.

Im not sure that the marker from buildings would work since buildings and improvements have different schemas. At least I hope they do, be really weird if they didn't.
 
Once the SDK is out, it should be pretty easy to add new tags like what you want.

Speaking of which, I wonder if it will be possible to add a tag that allows improvements to *Grow*, like Cottages did in Civ4?

Aussie.
 
Please release this on the ingame thingy if you get it to work properly, i'd LOVE it :)
Small mini-mods like these are gems.

I also hate how the AI builds trading posts everywhere, like the hamlets in civ4, so having them be limited to rivers or/and roads would help. (as long as the ai doesnt build roads in every tile now to support it, LOL side effect disaster)
 
Aussie_Lurker, I think they already have a tag for growth they just didn't use it in their own works. "Featuregrowth". Im going to try and mess with it and the improvement upgrade tag to see if I can't recreate the cottages of civ 4. Just a test of theory as I like the trade posts better anyways.
 
Back
Top Bottom