Modding Trade Routes

BrotherAmael

Chieftain
Joined
Feb 10, 2011
Messages
1
There are a couple of things I would like to mod which seem to be out of the scope of the XML language. I am struggling to get into Lua so if someone proficient in modding with Lua could tell me how to do this or point me in the right way I'd appreciate it.

I'd like to make trade routes active on cities connected by rivers from the start of the game (possibly triggered by Agriculture tech?).

I'd also like to make trade routs active on cities connected by coastal tiles after researching Sailing, or possibly after constructing a new building type which has sailing as a prerequisite.

I started trying to do this through XML and found that the Harbor has the following line

<AllowsWaterRoutes>true</AllowsWaterRoutes>

However I couldn't find where this opition is defined. It currently allows trade on both ocean and coast tiles. I want an option where trade is allowed on coast, but not ocean.

To find a way to implement trade routs on rivers I looked at Hiawatha's trait:

<TraitType>TRAIT_IGNORE_TERRAIN_IN_FOREST</TraitType>

This allows forests to act exactly like roads, but again, it is not defined anywhere in XML so i can't change it to work for rivers. I don't want rivers to give any movement bonus so simply making them act exactly like roads isn't great (if it's even possible). I assumed that it's pointing to the roads entry in the Routes.xml at some point, in which case, if you could make annother version of Hiawatha's trait, you could write a new entry in routs without the movement bonus?

So... Looks like I need to use Lua, but I've no clua about it (beyond using it as a calculator or to do some algebra...).

After having a rummage through the CIV 5 Lua API I came up with these relevent sounding terms:

Player:
CanTradeWith

TerrainTypes:
TERRAIN_COAST

City:
IsHasBuilding
IsCoastal

TeamTech:
HasTech

Team:
IsHasTech

Plots:
IsRoute
SetRouteType
IsRiverSide
IsRiverConnection


However, I haven't a clua what to do with them!

Is this even possible? Sorry if I sound like I don't know what I'm talking about. It's because I don't.

Cheers

BA
 
Even if this is possible by completely rewriting the trade logic in Lua (which might be slow), I would strongly advise against trying it as your first project. There's no easy way to switch connected status in Lua.

Welcome to the forums, by the way!
 
Back
Top Bottom