Part 7: Trade & Empire map

CloseTradeRoute(uint inRouteIndex)
This closes the trade route identified by its world site index in the XML file. Example use:

  game.CloseTradeRoute(7);

This closes world site 7. This can be used when certain specified conditions are met or randomly to reflect periodic disruptions to trade. If the site is visible then the player can re-open the trade route again by paying the appropriate price. If invisible, then it can only be opened again through OpenTradeRoute (described below). Note that trade route closure by this route does not take immediate effect - traders only stop appearing when a new year starts.

GetEmpireLevelLocked(uint inRouteIndex, out bool outLocked)
Not tested, but presumably determines whether the site has been locked/unlocked as described below. Given that locking/unlocking only changes the appearance of the site on the Empire Map, this would appear to be of limited use.

GetIsTradeRouteOpen(uint inRouteIndex, out bool outOpen)
Called to determine if the specified trade route, identified by its world site index in the XML file, is open. Example use:

  bool isOpenLatium = false;
  game.GetIsTradeRouteOpen(0, out isOpenLatium);

If the world site index corresponds to that of the home city, outOpen will be returned as "true". The flag will also be "true" if it is an enemy camp, but only if it is active and visible.

GetIsTradeRouteOpen(ref string inRouteName, out bool outOpen)
Called to determine if the specified trade route, identified by its name, is open. Usage is otherwise as described above. Example (from the Genoa tutorial):

  bool isOpenCaralis = false;
  string szSiteName = "Caralis";
  game.GetIsTradeRouteOpen(ref szSiteName, out isOpenCaralis);

LockEmpireLevelSite(uint inRouteIndex)
This function has no effect other than to change the color of the specified site to grey on the Empire Map. It has no effects on trade routes (if trade is open, it remains open; if closed, it can still be opened in the usual manner). Therefore, its only apparent use is to illustrate changes in the state of a site following a particular storyline (e.g. an enemy camp is taken out; a trade partner is under siege, etc.). Example use:

  game.LockEmpireLevelSite(7);

OpenTradeRoute(uint inRouteIndex)
This opens the trade route identified by its world site index in the XML file. Example use:

  game.OpenTradeRoute(7);

This opens world site 7. This can be used when certain specified conditions are met. It is the only way of opening an "invisible" trade city; if the city is visible on the Empire map, the player can always pay the cost of opening the route without meeting the conditions specified in the custom script.

It can also be used if an invisible city is used as a trigger for Victory or Defeat - the effect is to activate the city which can be set as a victory/defeat condition within the editor.

Notes:

  1. If the trade depot/port is already built, this call appears to spawn a trader.
  2. Calling this on an Enemy Camp has no effect (you cannot open trade with an enemy).

UnlockEmpireLevelSite(uint inRouteIndex)
This function has no effect other than to change the color of the specified site from grey to colored on the Empire Map. It has no effects on trade routes (if trade is closed, it remains closed). Therefore, its only apparent use is to illustrate changes in the state of a site following a particular storyline (e.g. an enemy camp becomes active, indicating imminent attack, trade partner recovers from a disaster, etc.). Example use (affecting world site 7 as identified in the XML file):

  game.UnlockEmpireLevelSite(7);

ClearWorldWaypointsBetween(ref string inFromMapLabel, ref string inToMapLabel)
Purpose unclear. I thought this might enable you to edit the Empire map during a game. However, from testing I've not seen any observable effect.

InsertWorldWaypoint(int inWaypointNumber, int inWaypointType, ref string inFromMapLabel, ref string inToMapLabel, int inX, int inY)
Unknown purpose. Tried testing this but no observable effect, e.g. on Empire Map.

< Previous: Other event methods | Editor Guide | Next: Invasions >