starting_conditions.lua

This script contains some convenience functions intended mainly for use in the Discovery and New World starting conditions.

To make these functions available include this file at the beginning of a script via:

include "scripting/starting_condition.lua"
sleep_then_goto(player, sleeptime, field)

Wait for the given number of milliseconds, then center the interactive player’s map view on the given Field.

This function returns immediately after calling.

Parameters
  • player (Player) – The player to move the view for

  • sleeptime (integer) – The number of milliseconds to wait

  • field (Field) – The field to center the view on

Returns

nil

launch_expeditions(player, items)

Creates some expedition ships in random places with the given additional items on them. If called for the interactive player, centers the view on an arbitrary of these ships.

Parameters
  • player (Player) – The player to use

  • items – An array of tables with ware_or_worker_name = amount pairs. As many ships will be created as there are subtables, and the n-th ship created will load the additional wares and workers defined in items[n]. The capacity of each ship will be adjusted to accommodate the build cost of the player’s tribe’s port building plus one builder plus the number of additional items for this ship.

Returns

nil