GameEvents (Civ5 Type): Difference between revisions
(→C) |
(adding some more events) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 28: | Line 28: | ||
|align="right" |<code><!-- No return type --></code> | |align="right" |<code><!-- No return type --></code> | ||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityBuildingsIsBuildingSellable}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|BuildingType}} building<b>)</b></code> | |width="100%" |<code>{{FuncLabel5|GameEvents|CityBuildingsIsBuildingSellable}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|BuildingType}} building<b>)</b></code> | ||
<!-- | |||
CITYCANANYBUYPLOT | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanBuyAnyPlot}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city<b>)</b></code> | |||
<!-- | |||
CITYCANBUYPLOT | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanBuyPlot}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, '''int''' x, '''int''' y<b>)</b></code> | |||
<!-- | <!-- | ||
CITYCANCONSTRUCT | CITYCANCONSTRUCT | ||
Line 34: | Line 48: | ||
{{FuncInfos5|yes |maybe|yes|Similar to CanDeclareWar, this allows provision of critera for the ability to construct a particular building (including Wonders, presumably) in a particular city. Based on the behaviour in the 1066 scenario, it seems that returns of false lead to the building not appearing in the list of buildings available to construct, rather than being greyed out, but this hasn't been specifically checked. It makes some sense, though, as there's no way to provide a tooltip to explain the greying out under this mechanism. As with CanDeclareWar, it's unclear whether multiple listeners' returns are combined with AND or OR; either seems possible according to the detailed explanation of how these events are handled.}} | {{FuncInfos5|yes |maybe|yes|Similar to CanDeclareWar, this allows provision of critera for the ability to construct a particular building (including Wonders, presumably) in a particular city. Based on the behaviour in the 1066 scenario, it seems that returns of false lead to the building not appearing in the list of buildings available to construct, rather than being greyed out, but this hasn't been specifically checked. It makes some sense, though, as there's no way to provide a tooltip to explain the greying out under this mechanism. As with CanDeclareWar, it's unclear whether multiple listeners' returns are combined with AND or OR; either seems possible according to the detailed explanation of how these events are handled.}} | ||
|align="right" |<code><!-- No return type --></code> | |align="right" |<code><!-- No return type --></code> | ||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanConstruct}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, {{Type5|BuildingType}} buildingType<b>)</b></code><!-- | |width="100%" |<code>{{FuncLabel5|GameEvents|CityCanConstruct}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, {{Type5|BuildingType}} buildingType<b>)</b></code> | ||
<!-- | |||
CityCanCreate | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanCreate}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, {{Type5|ProjectType}} projectType<b>)</b></code> | |||
<!-- | |||
CityCanMaintain | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanMaintain}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, {{Type5|ProcessType}} processType<b>)</b></code> | |||
<!-- | |||
CityCanPrepare | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|CityCanPrepare}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|CityID}} city, {{Type5|SpecialistType}} specialistType<b>)</b></code> | |||
<!-- | |||
CITYCANTRAIN | CITYCANTRAIN | ||
--> | --> | ||
Line 88: | Line 124: | ||
|align="right" |<code><!-- No return type --></code> | |align="right" |<code><!-- No return type --></code> | ||
|width="100%" |<code>{{FuncLabel5|GameEvents|GameCoreUpdateBegin}}<b>(</b><!-- No arguments --><b>)</b></code> | |width="100%" |<code>{{FuncLabel5|GameEvents|GameCoreUpdateBegin}}<b>(</b><!-- No arguments --><b>)</b></code> | ||
<!-- | |||
GAMECOREUPDATEEND | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|GameCoreUpdateEnd}}<b>(</b><!-- No arguments --><b>)</b></code> | |||
<!-- | <!-- | ||
GETFOUNDERBENEFITSRELIGION | GETFOUNDERBENEFITSRELIGION | ||
Line 130: | Line 173: | ||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerAdoptPolicy}}<b>(</b>{{Type5|PlayerID}} player, '''int''' policyID<b>)</b></code> | |width="100%" |<code>{{FuncLabel5|GameEvents|PlayerAdoptPolicy}}<b>(</b>{{Type5|PlayerID}} player, '''int''' policyID<b>)</b></code> | ||
<!-- | <!-- | ||
PlayerCanConstruct | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanConstruct}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|BuildingType}} buildingType<b>)</b></code> | |||
<!-- | |||
PlayerCanCreate | |||
--> | --> | ||
|- | |- | ||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | {{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | ||
|align="right" |<code><!-- No return type --></code> | |align="right" |<code><!-- No return type --></code> | ||
|width="100%" |<code>{{FuncLabel5|GameEvents| | |width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanCreate}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|ProjectType}} projectType<b>)</b></code> | ||
<!-- | |||
PlayerCanMaintain | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanMaintain}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|ProcessType}} processType<b>)</b></code> | |||
<!-- | |||
PlayerCanPrepare | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanPrepare}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|SpecialistType}} specialistType<b>)</b></code> | |||
<!-- | |||
PlayerCanResearch | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanResearch}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|TechType}} techType<b>)</b></code> | |||
<!-- | |||
PlayerCanEverResearch | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanEverResearch}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|TechType}} techType<b>)</b></code> | |||
<!-- | |||
PlayerCanTrain | |||
--> | |||
|- | |||
{{FuncInfos5|maybe|yes |no |<!-- No comment -->}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|PlayerCanTrain}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|UnitType}} unitType<b>)</b></code> | |||
<!-- | <!-- | ||
PLAYERCITYFOUNDED | PLAYERCITYFOUNDED | ||
Line 224: | Line 309: | ||
|align="right" |<code><!-- No return type --></code> | |align="right" |<code><!-- No return type --></code> | ||
|width="100%" |<code>{{FuncLabel5|GameEvents|UnitGetSpecialExploreTarget}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|UnitID}} unitID<b>)</b></code> | |width="100%" |<code>{{FuncLabel5|GameEvents|UnitGetSpecialExploreTarget}}<b>(</b>{{Type5|PlayerID}} player, {{Type5|UnitID}} unitID<b>)</b></code> | ||
<!-- | |||
UnitKilledInCombat | |||
--> | |||
|- | |||
{{FuncInfos5|yes |maybe|yes|}} | |||
|align="right" |<code><!-- No return type --></code> | |||
|width="100%" |<code>{{FuncLabel5|GameEvents|UnitKilledInCombat}}<b>(</b>{{Type5|PlayerID}} killer, {{Type5|PlayerID}} killee, {{Type5|UnitType}} killeeUnitType<b>)</b></code> | |||
<!-- | <!-- | ||
UNITSETXY | UNITSETXY |
Latest revision as of 01:10, 21 February 2014
This page is a part of the Lua and UI Reference (Civ5).
Usage
This object exposes events that you can use to modify the gameplay. As opposed to the events defined on Events and LuaEvents, most of those events are expected to return a value. This value may then be used by the game to prevent or trigger some game actions (such as a declaration of war), or to override some calculations (for example by adding a bonus or a malus to the diplomatic status between two civilizations). Please look at the events' pages to learn more.
Static Events
Events can be subscribed by using GameEvents.SomeEvent.Add(SomeFunction)
. Regular events can also be fired through a dot by using GameEvents.SomeEvent(<args>)
. This will invoke all subscribers with the provided arguments.
C
bool
|
CanDeclareWar(TeamID myTeam, TeamID theirTeam)
| ||||
|
CityBuildingsIsBuildingSellable(PlayerID player, BuildingType building)
| ||||
|
CityCanBuyAnyPlot(PlayerID player, CityID city)
| ||||
|
CityCanBuyPlot(PlayerID player, CityID city, int x, int y)
| ||||
|
CityCanConstruct(PlayerID player, CityID city, BuildingType buildingType)
| ||||
|
CityCanCreate(PlayerID player, CityID city, ProjectType projectType)
| ||||
|
CityCanMaintain(PlayerID player, CityID city, ProcessType processType)
| ||||
|
CityCanPrepare(PlayerID player, CityID city, SpecialistType specialistType)
| ||||
|
CityCanTrain(PlayerID player, CityID city, UnitType unitType)
| ||||
|
CityCaptureComplete(PlayerID player, int capital, ResourceType x, ResourceType y, PlayerID newPlayer, int conquest, int conquest)
| ||||
|
CityConvertsReligion(PlayerID owner, ReligionType religion, int x, int y)
|
D
|
DoResolveVictoryVote(bool preliminaryVote)
|
G
|
GameCoreTestVictory()
| ||||
|
GameCoreUpdateBegin()
| ||||
|
GameCoreUpdateEnd()
| ||||
|
GetFounderBenefitsReligion(PlayerID player)
| ||||
|
GetReligionToSpread(PlayerID player)
| ||||
|
GetScenarioDiploModifier1(PlayerID player1, PlayerID player2)
| ||||
|
GetScenarioDiploModifier2(PlayerID player1, PlayerID player2)
|
P
|
PlayerAdoptPolicy(PlayerID player, int policyID)
| ||||
|
PlayerCanConstruct(PlayerID player, BuildingType buildingType)
| ||||
|
PlayerCanCreate(PlayerID player, ProjectType projectType)
| ||||
|
PlayerCanMaintain(PlayerID player, ProcessType processType)
| ||||
|
PlayerCanPrepare(PlayerID player, SpecialistType specialistType)
| ||||
|
PlayerCanResearch(PlayerID player, TechType techType)
| ||||
|
PlayerCanEverResearch(PlayerID player, TechType techType)
| ||||
|
PlayerCanTrain(PlayerID player, UnitType unitType)
| ||||
|
PlayerCityFounded(PlayerID player, int cityX, int cityY)
| ||||
|
PlayerDoTurn(PlayerID player)
| ||||
|
PlayerPreAIUnitUpdate(PlayerID player)
| ||||
|
PreGameStart
|
S
|
SetAlly(PlayerID cSPlayer, PlayerID oldAlly, PlayerID newAlly)
| ||||
|
SetPopulation(int x, int y, unknown oldPopulation, int newPopulation)
|
T
|
TeamMeet(unknown playeractive, unknown playermet)
| ||||
|
TeamSetHasTech(TeamID team, TechType tech, bool adopted)
| ||||
|
TeamTechResearched(TeamID team, TechType tech, int change)
|
U
|
UnitGetSpecialExploreTarget(PlayerID player, UnitID unitID)
| ||||
|
UnitKilledInCombat(PlayerID killer, PlayerID killee, UnitType killeeUnitType)
| ||||
|
UnitSetXY(PlayerID player, UnitID unit, int x, int y)
|
Static Methods
Methods are functions that belong to an object. Static methods are invoked through a dot, as in GameEvents.SomeMethod(<args>)
. When a dot is used the caller object is not implicitly provided as the first argument.
|
Accumulate
| ||||
|
AccumulateINT
| ||||
|
Add
| ||||
|
Call
| ||||
|
Count
| ||||
|
Remove
| ||||
|
RemoveAll
| ||||
|
TestAll
| ||||
|
TestAny
|
The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.