Trade node modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

This page is an explanation of how to mod a trade nodes. The relevant folder is /Europa Universalis IV/common/tradenodes. In the vanilla game, this folder only contains one file 00_tradenodes.txt. To change the existing nodes and connections between them, you must edit that file. In case you are simply adding nodes or connections, a new file may be added to the folder (eg 01_hormuz_to_ceylon.txt).

Warning: Trade companies, events, missions, and decisions reference specific trade nodes in their scripting. Deleting a node will require modding these files as well. Adding/removing connections, on the other hand, should cause no conflicts.

Trade nodes code[edit]

A trade node is defined as follows.

hormuz={
	location=1334
	outgoing={
		name="basra"
		path={
			2219 1335 
		}
		control={
			3687.000000 1082.000000 3650.000000 1073.000000 
		}
	}
	members={
		435 2224 2229 2230 #sistan_area
		397 398 404 2333 #pirate_coast_area
		432 2220 2234 4345 #kerman_area
		434 575 2231 2232 2233 #makran_area
		430 2219 2223 4332  #persian_gulf_coast
		2218 4329 4330 4331 #farsistan_area
		403 4285 4287 #oman_area
		399 400 4286 #mascat_area
		431 2999 4327 #mogostan_area
		1332 1334 1335 4347#Sea
	}
}

Name[edit]

Each trade node needs a unique name, which begin the entry. If you are adding connections to an existing node in a new file, simply use the same name, and enlose a new outgoing.

hormuz={
	outgoing={
		# Your code here
	}
} 

Location[edit]

This is the province ID of the trade node. In the example above, it is the Straits of Hormuz. On the map, it is represented as a harbor buoy for sea provinces, a trade depot for land provinces. If it is a land province, you can optionally add the line inland=yes to mark the node to use caravan power.

Members[edit]

This is a list of all province IDs that contribute trade value and trade power to a node. You must include the location ID as well. Be sure to add sea provinces as well so light ships can protect trade.

Outgoing[edit]

Each node either has outgoing connections, or is an end node. If it is an end node, simply add end=yes. Otherwise, add connections, each in their own outgoing={} closure.

In the example above, name indicates that the connection goes to the Basra trade node. The path is a list of adjacent provinces that lead from the Straits of Hormuz (1334) to the Persian Gulf (1335), which is the location of the Basra trade node. control determines the visual representation of the trade route on the map; they are pairs of X, Y coordinates that mark the inflection points of the curving line between trade nodes. Add as many as needed to created for longer, snaking paths.

Getting the route to look right requires some trial and error. Consult /Europa Universalis IV/common/map/positions.txt to get the X, Y coordinates of various provinces.

A Complete Example[edit]

Here is an example modding the Malacca trade node. It removes the connection from Malacca to Zanzibar, and adds one between Malacca and Ceylon.

malacca={
	location=1361
	outgoing={
		name="comorin_cape"
		path={
			1348 1349 1613 1614 1340
			# Straits of Malacca -> Nicobar Islands ->
			# Southern Bay of Bengal -> Ceylon Sea ->
			# Comorin Cape
		}
		control={
			4242.000 787.000 4092.000 727.000
			# Nicobar Islands -> Ceylon Sea (down 25px)
		}
	}
	outgoing={
		name="ganges_delta"
		path={
			1348 1347 1345 1344 1343 
		}
		control={
			4329.000000 740.000000 4311.000000 813.000000 4279.000000 878.000000 4242.000000 943.000000 
		}
	}
	members={
		593 594 595 596 597 598 599 617 618 619 620 621 622 623 636 637 638 639 640 659 1361 1998 1999 2390 2391 2392 2393 2394 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2740 1101 
	}
	
	ai_will_propagate_through_trade = yes
}

Localisations[edit]

Localisation is handled in the same way as any other localisation string. For example:

 comorin_cape:0 "Ceylon"
Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localization
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe Validator
Guides Adding a province