贸易路线模组制作

(重定向自Trade route modding

Provinces along a trade route benefit from bonuses to local tax income, movement speed, and technology spread. Certain provinces along a trade route can also construct trade posts, which provide trade income to the owner of the province. The course of a trade route is defined in the /common/trade_routes/ folder.

Creating a Basic Trade Route

A trade route's bonuses, source, course, and major stops must be defined by a .txt file in the /common/trade_routes/ folder. As an example:

trier_tree_trade = {
	wealth = 100  # Multiplier for other modifiers. Modifiers calculated as (Wealth * modifier)/# of trade provinces.
	trade_post_display_trigger = {# Determines which provinces will have the Potential Trade Post tool-tip.
		OR = {
			province_id = 127 #Lorraine
			province_id = 118 #Trier
		}
	}

	modifier = { # Modifiers applied to each province on a trade route.                    
		castle_tax_modifier = 0.01 # Percentage multiplier applied to tax income for castle holdings in a province
		city_tax_modifier = 0.01 # Percentage multiplier applied to tax income for city holdings in a province. 
		temple_tax_modifier = 0.01 # Percentage multiplier applied to tax income for temple holdings in a province. 
		tribal_tax_modifier = 0.01 # Percentage multiplier applied to tax income for tribal holdings in a province. 
		trade_route_value = 2.5 # Modifier used to determine base trade route income for a trade post on a province.
		local_movement_speed = 0.025 # Percentage multiplier applied to movement speed of troops through a province.
		tech_growth_modifier = 0.025 # Percentage multiplier for technology spread between provinces.
		icon = 4 # Sets the icon displayed for the province modifier, in this case the Stewardship icon.
	}

	start = { # Starting province for the trade route. Trade flows from this province to all other provinces connected downstream.
		127 # Lorraine
	}
	path = { # Creates a connection between either a starting province or an already defined end province of a previous path.
		127 128 118 # Lorraine - Metz - Trier
	}
}

The end result of this code, the Trier tree trade, is a trade route that starts in Lorraine, passes through Metz, and ends in Trier, and that grants a 33.3% bonus to local income, a 83.3% bonus to local movement speed and technology spread, and a base income of 83.3 for any trade posts built along the trade route. Now that the Trier tree trade has been defined, localization can be added to change the name of the province modifier. Creating a .csv file under /localisation/ will add a localization for the trade route:

trier_tree_trade;Trier Tree Trade;;;;;;;;;;;;;x

Finally, a scripted trigger is required to allow the construction of trade posts on Potential Trade Post counties. Creating a .txt file under /common/scripted_triggers/, and add a trade route post trigger:

trade_route_post_trigger = { custom_tooltip = { text = trade_route_province_desc hidden_tooltip = { OR = { province_id = 127 # Lorraine province_id = 118 # Trier } } } }

The Trier tree trade is now complete - its province modifiers apply, trade posts can be built in Lorraine and Trier, and its name is now properly localized to display in-game.

Trade Route Pathing

A path connects either a starting province or previously defined end province to a new end province. These provinces do not need to be adjacent. Both path = { 127 128 118} and path = { 127 118} are valid. A path cannot connect a province defined in an existing path that was not the end province of that path. As an example:

path = { 127 128 118 } # Lorraine - Metz - Trier
path = { 128 123 } # Metz - Mainz

The second path between Metz and Mainz is invalid. In order to create a valid path between Metz and Mainz, Metz must be the end province of an existing path:

path = { 127 128} # Lorraine - Metz path = { 128 118} # Metz - Trier path = { 128 123} # Metz - Mainz

Provinces in a path can also be non-county provinces, such as major rivers and sea tiles. The same pathing rules apply for these provinces as well as counties. IDs for these non-county provinces can be found in /map/definition.csv As an example, adding a path for Rhine river trade from Trier to Holland:

path = { 127 128} # Lorraine - Metz path = { 128 118} # Metz - Trier path = { 128 123} # Metz - Mainz path = { 118 1045 1043 1044 80 } # Trier - Rhine River - Holland