Lua Game Events: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


[http://forums.civfanatics.com/showthread.php?t=385612 Lua Events List] or the same [http://wiki.2kgames.com/civ5/index.php/Lua_Game_Events in the official wiki]
[http://forums.civfanatics.com/showthread.php?t=385612 Lua Events List] or the same [http://wiki.2kgames.com/civ5/index.php/Lua_Game_Events in the official wiki]
==Game==
*[[LoadScreenClose]]
*[[PreGameDirty]]
*[[SerialEventEndTurnDirty]]
*[[SequenceGameInitComplete]]
*[[SerialEventGameDataDirty]]
*[[SerialEventStartGame]]
*[[GameEvents.PreGameStart]] - called before most items in the game are initialized.
==Team==
*[[GameEvents.TeamSetHasTech(teamID, techID)]]
*[[GameEvents.TeamTechResearched(eTeam, eTech, iChange)]] - triggered when a team researches a tech.


==Player==
==Player==
Line 16: Line 34:




GameEvents (from patch 1.0.1.332):
*[[GameEvents.CanDeclareWar(team1, team2)]] - allows provision of criteria for the ability of team1 to declare war on team2. As this is a TestAll event, all listeners must return true for the action to be permitted.
*[[GameEvents.PlayerAdoptPolicy(playerID, policyTypeID)]]
*[[GameEvents.PlayerAdoptPolicy(playerID, policyTypeID)]]
*[[GameEvents.PlayerAdoptPolicyBranch(playerID, policyBranchTypeID)]]
*[[GameEvents.PlayerAdoptPolicyBranch(playerID, policyBranchTypeID)]]
Line 28: Line 46:
*[[GameEvents.PlayerCanResearch(playerID, techTypeID)]]
*[[GameEvents.PlayerCanResearch(playerID, techTypeID)]]
*[[GameEvents.PlayerCanTrain(playerID, unitTypeID)]]
*[[GameEvents.PlayerCanTrain(playerID, unitTypeID)]]
*[[GameEvents.TeamSetHasTech(teamID, techID)]]
*[[GameEvents.PlayerDoTurn()]] - fired once per turn for each player (not just active/human player), at the start of turn; also, it seems not to run for the first turn of the game (for all players), runs only for human player on the second turn, and thereafter it runs for all players.
*[[GameEvents.PlayerPreAIUnitUpdate(playerId)]]
*[[GameEvents.SetAlly(iCSPlayer, iOldAlly, iNewAlly)]] - triggered when the ally of a City-State changes (whether it changes from none or from another player).
*[[GameEvents.TeamMeet(playerActive, playerMet)]] - presumably called when players meet, but referring to teams.
 


==City==
==City==
Line 49: Line 71:




GameEvents (from patch 1.0.1.332):
*[[GameEvents.CityCanBuyAnyPlot(ownerID, cityID)]]
*[[GameEvents.CityCanBuyAnyPlot(ownerID, cityID)]]
*[[GameEvents.CityCanBuyPlot(ownerID, cityID, plotX, plotY)]]
*[[GameEvents.CityCanBuyPlot(ownerID, cityID, plotX, plotY)]]
*[[GameEvents.CityCanConstruct(iPlayer, iCity, iBuildingType)]] - 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.
*[[GameEvents.CityCanCreate(ownerID, cityID, projectTypeID)]]
*[[GameEvents.CityCanCreate(ownerID, cityID, projectTypeID)]]
*[[GameEvents.CityCanMaintain(ownerID, cityID, processTypeID)]]
*[[GameEvents.CityCanMaintain(ownerID, cityID, processTypeID)]]
*[[GameEvents.CityCanPrepare(ownerID, cityID, specialistTypeID)]]
*[[GameEvents.CityCanPrepare(ownerID, cityID, specialistTypeID)]]
*[[GameEvents.CityCanTrain(ownerID, cityID, unitTypeID)]]
*[[GameEvents.CityCanTrain(ownerID, cityID, unitTypeID)]]
*[[GameEvents.CityCaptureComplete(playerID, bCapital, iX, iY, newPlayerID)]]
*[[GameEvents.SetPopulation(iX, iY, oldPopulation, newPopulation)]]


==Unit==
==Unit==
Line 104: Line 129:
*[[RunCombatSim]]
*[[RunCombatSim]]
*[[EndCombatSim]]
*[[EndCombatSim]]
*[[GameEvents.UnitGetSpecialExploreTarget(iPlayerID, iUnitID)]] - appears to be triggered when the 'explore' order is given, or some subset thereof. The unit structure for the relevant unit is manipulated to set the explore target.
*[[GameEvents.UnitSetXY(iPlayer, iUnitID, iX, iY)]] - triggered whenever any unit moves by any means, for every tile they move into.


==Map objects==
==Map objects==
Line 121: Line 151:
*[[SerialEventJungleCreated]]
*[[SerialEventJungleCreated]]
*[[SerialEventJungleRemoved]]
*[[SerialEventJungleRemoved]]


==Hex==
==Hex==
Line 145: Line 176:
*[[UnitHexHighlight]]
*[[UnitHexHighlight]]


==Game==
 
*[[LoadScreenClose]]
*[[PreGameDirty]]
*[[SerialEventEndTurnDirty]]
*[[SequenceGameInitComplete]]
*[[SerialEventGameDataDirty]]
*[[SerialEventStartGame]]
===Mods===
===Mods===
*[[AfterModsActivate]]
*[[AfterModsActivate]]
Line 160: Line 185:
*[[ModDownloadComplete]]
*[[ModDownloadComplete]]
*[[ModDownloadStarted]]
*[[ModDownloadStarted]]


==Interface==
==Interface==
Line 189: Line 215:
*[[NotificationAdded]]
*[[NotificationAdded]]
*[[NotificationRemoved]]
*[[NotificationRemoved]]


==Game Systems==
==Game Systems==
Line 247: Line 274:
*[[MultiplayerProfileFailed]]
*[[MultiplayerProfileFailed]]
*[[RemotePlayerTurnEnd]]
*[[RemotePlayerTurnEnd]]


==Other (unsorted)==
==Other (unsorted)==

Latest revision as of 09:49, 16 February 2012

Up: Lua and UI Reference

Lua Events List or the same in the official wiki


Game



Team


Player



City



Unit

CombatSim



Map objects

Improvements

Features


Hex


Mods


Interface

Advisor

Dawn of Man

Diplomacy

Menus

Notifications


Game Systems

Animation

Audio

Camera

Multiplayer


Other (unsorted)