The scenario library

From Scenario League Wiki
Jump to navigationJump to search

Back To TOTPP Functions


onTurn

civ.scen.onTurn(function (turn) -> void)


onUnitKilled

civ.scen.onUnitKilled(function (loser, winner) -> void)


onScenarioLoaded

civ.scen.onScenarioLoaded(function () -> void)


onNegotiation

civ.scen.onNegotiation(function (talker, listener) -> boolean)


onSchism

civ.scen.onSchism(function (tribe) -> boolean)


onCityTaken

civ.scen.onCityTaken(function (city, defender) -> void)


onCityProduction

civ.scen.onCityProduction(function (city, prod) -> void)


onCentauriArrival

civ.scen.onCentauriArrival(function (tribe) -> void)


onCityDestroyed

civ.scen.onCityDestroyed(function (city) -> void)


onBribeUnit

civ.scen.onBribeUnit(function (unit, previousOwner) -> void)


onGameEnds

civ.scen.onGameEnds(function (reason) -> boolean)


onKeyPress

civ.scen.onKeyPress(function (keyCode) -> void)

Registers a function to be called every time a key is pressed.


onActivateUnit

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.


onCityFounded

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.


onResolveCombat

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.


onCanBuild

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.