GameEvents (Civ5 Type)

From Civilization Modding Wiki
Revision as of 15:18, 19 September 2012 by DonQuich (talk | contribs) (Bot update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Base game Gods & Kings ___________________________
Check.png Question.png Star.png Speech.png bool CanDeclareWar(TeamID myTeam, TeamID theirTeam)
Cross.png Check.png Star.png Speech.png CityBuildingsIsBuildingSellable(PlayerID player, BuildingType building)
Check.png Question.png Star.png Speech.png CityCanConstruct(PlayerID player, CityID city, BuildingType buildingType)
Check.png Check.png Star.png Speech.png CityCaptureComplete(PlayerID player, int capital, ResourceType x, ResourceType y, PlayerID newPlayer, int conquest, int conquest)
Cross.png Check.png Star.png Speech.png CityConvertsReligion(PlayerID owner, ReligionType religion, int x, int y)

D

Base game Gods & Kings ___________________________
Cross.png Check.png Star.png Speech.png DoResolveVictoryVote(bool preliminaryVote)

G

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png GameCoreTestVictory()
Question.png Check.png Star.png Speech.png GameCoreUpdateBegin()
Cross.png Check.png Star.png Speech.png GetFounderBenefitsReligion(PlayerID player)
Cross.png Check.png Star.png Speech.png GetReligionToSpread(PlayerID player)
Cross.png Check.png Star.png Speech.png GetScenarioDiploModifier1(PlayerID player1, PlayerID player2)
Cross.png Check.png Star.png Speech.png GetScenarioDiploModifier2(PlayerID player1, PlayerID player2)

P

Base game Gods & Kings ___________________________
Question.png Check.png Star.png Speech.png PlayerAdoptPolicy(PlayerID player, int policyID)
Question.png Check.png Star.png Speech.png PlayerCanAdoptPolicyBranch(PlayerID player, int policyBranch)
Cross.png Check.png Star.png Speech.png PlayerCityFounded(PlayerID player, int cityX, int cityY)
Check.png Check.png Star.png Speech.png PlayerDoTurn(PlayerID player)
Question.png Question.png Star.png Speech.png PlayerPreAIUnitUpdate(PlayerID player)
Question.png Question.png Star.png Speech.png Question-blue.png PreGameStart

S

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png SetAlly(PlayerID cSPlayer, PlayerID oldAlly, PlayerID newAlly)
Check.png Question.png Star.png Speech.png SetPopulation(int x, int y, unknown oldPopulation, int newPopulation)

T

Base game Gods & Kings ___________________________
Question.png Question.png Star.png Speech.png TeamMeet(unknown playeractive, unknown playermet)
Question.png Check.png Star.png Speech.png TeamSetHasTech(TeamID team, TechType tech, bool adopted)
Check.png Check.png Star.png Speech.png TeamTechResearched(TeamID team, TechType tech, int change)

U

Base game Gods & Kings ___________________________
Check.png Question.png Star.png Speech.png UnitGetSpecialExploreTarget(PlayerID player, UnitID unitID)
Check.png Check.png Star.png Speech.png 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.

Base game Gods & Kings ___________________________
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png Accumulate
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png AccumulateINT
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png Add
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png Call
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png Count
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png Remove
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png RemoveAll
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png TestAll
CheckButZero.png CheckButZero.png Star.png Speech.png Question-blue.png 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.