The scenario library
Back To TOTPP Functions
civ.scen.onTurn(function (turn) -> void)
civ.scen.onUnitKilled(function (loser, winner) -> void)
civ.scen.onScenarioLoaded(function () -> void)
civ.scen.onNegotiation(function (talker, listener) -> boolean)
civ.scen.onSchism(function (tribe) -> boolean)
civ.scen.onCityTaken(function (city, defender) -> void)
civ.scen.onCityProduction(function (city, prod) -> void)
civ.scen.onCentauriArrival(function (tribe) -> void)
civ.scen.onCityDestroyed(function (city) -> void)
civ.scen.onBribeUnit(function (unit, previousOwner) -> void)
civ.scen.onGameEnds(function (reason) -> boolean)
civ.scen.onKeyPress(function (keyCode) -> void)
Registers a function to be called every time a key is pressed.
civ.scen.onActivateUnit(function (unit, source) -> void)
Registers a function to be called every time a unit is activated. The callback takes the unit activated as a parameter, and the source of unit activation. Source is `true` if activated by keyboard or mouse click, `false` if activated by the game itself.
civ.scen.onCityFounded(function (city) -> void)
Registers a function to be called every time a city is founded. The callback takes the city as a parameter.
civ.scen.onResolveCombat(function (defaultResolutionFunction, attacker, defender) -> boolean)
Registers a function to be called during every combat turn. The first parameter of the callback is the default resolution function, as implemented by the game. It takes the attacker and defender as parameters. You can call this to produce a result for cases you don't need to handle yourself. Return `true` to continue combat, `false` to stop.
civ.scen.onCanBuild(function (defaultBuildFunction, city, item) -> boolean)
Registers a function to be called every time a check is done whether a city can build something or not. It is called for all unit types, improvements and wonders. The first parameter of the callback is the default build function, as implemented by the game. It takes the city and item as parameters. You can call this to produce a result for cases you don't need to handle yourself. `item` can be a unittype, improvement or wonder. Return `true` if `city` is allowed to produce `item`, `false` if not.