Making Terrain Impassable without Roads/Railroads

RetroA

Chieftain
Joined
Sep 15, 2015
Messages
25
Location
UK
Hi all, not sure how many are still modding Civ5 but I'm having a little resurgence in the game and finishing up a small mod I started a while back and was hoping for some help.

I'm making a mod the prevents certain units from moving over rough terrain (forests, hills, rivers etc) unless there is a road/railroad over them whilst at the same time removing the movement bonus the units receive from the road/rail - so in essence very slow units that have to travel over road/rail or flat, unobstructed terrain.

Now I've managed to figure out how to do this for terrain features such as Forests, Marshes etc by giving the units the same promotion as the Helicopter Gunship (all terrain costs 1 movement) so they ignore the movement bonus from road/rail and with a promotion coded like this:

Spoiler :

<UnitPromotions_Features>
<Row>
<PromotionType>PROMOTION_WIDE_LOAD</PromotionType>
<FeatureType>FEATURE_JUNGLE</FeatureType>
<Impassable>true</Impassable>​
</Row>​
</UnitPromotions_Features>

I tried the following code to do the same with Hills and Rivers:

Spoiler :

<UnitPromotions_Features>
<Row>
<PromotionType>PROMOTION_WIDE_LOAD</PromotionType>
<FeatureType>FEATURE_RIVER</FeatureType>
<Impassable>true</Impassable>​
</Row>​
</UnitPromotions_Features>

<UnitPromotions_Terrains>
<Row>
<PromotionType>PROMOTION_WIDE_LOAD</PromotionType>
<TerrainType>TERRAIN_HILL</TerrainType>
<Impassable>true</Impassable>​
</Row>​
</UnitPromotions_Terrains>

But the river code doesn't seem to work at all (which I guess makes sense a river is not its own tile) and the hill code doesn't seem to work in conjunction with the 'all terrain costs 1 movement' promotion.

Any workarounds anyone knows or a different approach that could be taken for this?
 
Alternatively, does anyone know of way of simply making a unit ignore the road/rail movement bonus without using an all terrain costs 1 movement promotion like the Gunship?
 
Don't give them the all terrain costs 1 movement promo. What happens then?

The issue in rivers and hills is probably worse than just rivers not being considered a feature. You have to remember that a bunch of database changes means nothing if the executable isn't programmed to do anything with them. The game assets are swimming with tables that are just flimsy cardboard standees with no behaviour.

It's also possible that the behaviour tied to the UnitPromotions_Features table is ad hoc , not systematic. Basically a series of hardcoded cases.

I can guarantee you that you can't create a rule for the spaceship parts not to cross rivers without bridges, because there is no behaviour like that in the game. It's possible that whoward's Pick'N'Mix codebase has handled things like this though, and you might also note that he wrote a module that tries to induce some balance considerations of his own for the spaceship. For instance, if your capital falls, did you know that the parts already assembled still count? Take a look at his mods.
 
Thanks for the reply, Hermi. After a little more testing without using the All Terrain Costs 1 promotion, it seems making Hills impassable isn't possible either just using XML. You can make whole terrain types (grassland, plains, desert etc) impassable but they remain that way even with a road/railroad across them unlike features. And I figured rivers would be screwy like that, thanks for confirming. The point behind the promotion was to make the unit ignore the movement bonuses from railroads, it's the only way I know how to without using LUA, which I'm not too knowledgeable of. Didn't know that about the capital either, I'll check some of his mods out (more).
 
JFD's Exploration Continued Expanded makes Jungle impassable before Optics or with a specific promotion. Maybe you could look at his code and work it to what you want to do?
 
I believe that's achievable through XML as it is same with oceans being impassable before Astronomy but I'll take a closer look at the mod just to be sure, thanks for the tip!
 
Top Bottom