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

Possible to mod trade routes?

Discussion in 'Civ5 - Creation & Customization' started by Dunabar, Sep 18, 2014.

  1. Dunabar

    Dunabar Chieftain

    Joined:
    Sep 5, 2014
    Messages:
    55
    Gender:
    Male
    Location:
    United States
    I'm currently working on some blueprints for my mod and a thought crossed my mind. I admit I'm still a novice to modding Civ5, but I'm curious to know if it's possible to perform the following.

    1. Alter the trade route cap (IE: Can I have more than the normal max amount?)

    and if so...

    2. Create two different Cargo ship type units. (Ex: Trade Ships to be used just for :c5gold: & :c5science: trade with other Civilizations and Cargo Ships just to transfer :c5food: & :c5production: between coastal cities you own?)

    Thanks ahead of time for answering my question (If I don't reply back right away :D)
     
  2. Machiavelli24

    Machiavelli24 Mod creator

    Joined:
    May 9, 2012
    Messages:
    818
    You can use buildings to add (or remove) Trade Routes. See here for how. You may be able to reuse some code I wrote that adds a Trade Route every time a Custom's House is built.

    As for limiting international vs domestic routes, that would likely require editing the DLL.
     
  3. Dunabar

    Dunabar Chieftain

    Joined:
    Sep 5, 2014
    Messages:
    55
    Gender:
    Male
    Location:
    United States
    Awesome, thank you very much :goodjob:
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    Caravans and Cargo Ships are hard coded into the DLL (you can't even make civ specific variants of them like normal units) so splitting the cargo ship into two different types will definitely required heavy-lifting in the C++ code of the DLL
     
  5. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Super Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,867
    Location:
    Leeds (UK)
    If you're using XML, then you might find the following information useful for your mod.

    First of all, buildings/wonders:

    Code:
    <TradeRouteLandDistanceModifier>50</TradeRouteLandDistanceModifier>
    Increases the distance caravans can travel: one square for every multiple of 10.


    Code:
    <TradeRouteLandGoldBonus>200</TradeRouteLandGoldBonus>
    Increases the amount of gold gained per trade route: 1 gold for every multiple of 100.


    Code:
    <NumTradeRouteBonus>1</NumTradeRouteBonus>
    Adds one extra trade route.


    Code:
    <TradeRouteRecipientBonus>1</TradeRouteRecipientBonus>
    Gains one extra gold for trade routes coming into the city.


    [CODE<TradeRouteTargetBonus>1</TradeRouteTargetBonus>[/CODE]
    Any civilization sending a trade route to the city gains one extra gold.


    The Colossus and Petra automatically gain a cargo ship/caravan to go with their bonus trade route via this code:
    Code:
    <Building_FreeUnits>
    		<Row>
    			<BuildingType>BUILDING_COLOSSUS</BuildingType>
    			<UnitType>UNIT_CARGO_SHIP</UnitType>
    			<NumUnits>1</NumUnits>
    		</Row>
    	<Row>
    			<BuildingType>BUILDING_PETRA</BuildingType>
    			<UnitType>UNIT_CARAVAN</UnitType>
    			<NumUnits>1</NumUnits>
    		</Row>
    	</Building_FreeUnits>

    The trade routes can also be modded into traits (as I'm sure you know ;)).

    Venice gets double the number of trade routes like this:
    Code:
    <NumTradeRoutesModifier>100</NumTradeRoutesModifier>
    In Anno Domini, I've used the figure 50 to give the Phoenicians a free trade route for every two trade routes they already have.


    Code:
    <TradeRouteResourceModifier>100</TradeRouteResourceModifier>
    Resource diversity grants twice as much gold in trade routes for the civilization with this code.


    Code:
    <LandTradeRouteRangeBonus>5</LandTradeRouteRangeBonus>
    Increases the range by 10% times the number.


    Code:
    <TradeReligionModifier>100</TradeReligionModifier>
    Doubles the effect religion has in trade routes.


    Finally, the Gateway to Africa's "Receives +3 gold and +1 [ICON_CULTURE] culture for each trade route with a different civ or city-state. The trade route owners receive +2 gold for each trade route sent to Morocco" can be modified - both numerically and by what it receives, e.g. it could get faith instead of gold. Here's the raw code - any "yield" is acceptable.

    Code:
    	<Trait_YieldChangesPerTradePartner>
    		<Row>
    			<TraitType>TRAIT_GATEWAY_AFRICA</TraitType>
    			<YieldType>YIELD_GOLD</YieldType>
    			<Yield>3</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_GATEWAY_AFRICA</TraitType>
    			<YieldType>YIELD_CULTURE</YieldType>
    			<Yield>1</Yield>
    		</Row>
    	</Trait_YieldChangesPerTradePartner>
    	<Trait_YieldChangesIncomingTradeRoute>
    		<Row>
    			<TraitType>TRAIT_GATEWAY_AFRICA</TraitType>
    			<YieldType>YIELD_GOLD</YieldType>
    			<Yield>2</Yield>
    		</Row>
    	</Trait_YieldChangesIncomingTradeRoute>
     
    Lt_Karan likes this.
  6. Dunabar

    Dunabar Chieftain

    Joined:
    Sep 5, 2014
    Messages:
    55
    Gender:
    Male
    Location:
    United States
    Ooof, well that is a kick in the fellas. Well, if I can pull a rabbit out of my hat on it, I will share it willingly. I'm sure some look at that idea and think "Uhhh...why?"

    I -was- going to see about making the Merchant ships (Trade) look one way and the Transport ships (Cargo) look another. It was more for the idea of immersion than "Game logic." But, -if- it's impossible to do, than I will just bite the bullet on it. So long as the mod is enjoyed by others, losing one little bit of immersion is no real loss.
     
  7. Dunabar

    Dunabar Chieftain

    Joined:
    Sep 5, 2014
    Messages:
    55
    Gender:
    Male
    Location:
    United States
    Sweet! Thank you very much, Rob. I will make sure to put this all too good use in my mod when the time calls. I just need to get this Tech tree figured out in blueprint form before I move forward into the real grit of modding.
     
  8. Lt_Karan

    Lt_Karan Chieftain

    Joined:
    Jan 24, 2021
    Messages:
    34
    Lovely breakdown thanks for the amazing explanation.
     

Share This Page