CvEventManager

From Civilization Modding Wiki
Revision as of 01:09, 22 August 2009 by TC01 (talk | contribs)
Jump to navigationJump to search

The CvEventManager file controls what happens during events that occur in the game. These aren't events like Beyond the Sword random events but rather events like a unit moving, a turn beginning, or a nuclear explosion occuring. Some of the functions in this file are disabled in Beyond the Sword with PythonCallbackDefines.xml.

The Python files are written in the python programming language. They can be edited in a text editor such as notepad or in a programming editor like Python's IDLE.

This page is missing information. Do not remove this notice until it is complete.

Functions

Below is a list of all the functions in the file. Each function has a quick description attached to it. Note that there are comments strewn throughout some of these files, direct from the developers in order to aid the potential modders.

Function Parameters Description
def _init_() self Initializes variables in file
def handleEvent() self, argsList Event Manager entry point
def beginEvent() self, context, argsList=-1 Begins an event
def applyEvent() self, argsList (context, playerID, netUserData, popupReturn) Applies the effects of an event
def reportEvent() self, entry, context, argsList Records an event to Events.log
def onKdbEvent() self, argsList (eventType, key, mx, my, px, py) Handles the pressing of a key
def onModNetMessage() self, argsList (iData1, iData2, iData3, iData4, iData5) Called whenever CyMessageControl().sendModNetMessage is called
def onInit() self, argsList Called whenever Civilization starts up
def onUpdate() self, argsList (fDeltaTime) Called every frame
def onWindowActivation() self, argsList (bActive) Called when the game window activates or deactivates
def onUnInit() self, argsList Called before Civ shuts down
def onPreSave() self, argsList Called before the game is saved
def onSaveGame() self, argsList Returns the name of the save game
def onLoadGame() self, argsList Called on the loading of the game
def onGameStart() self, argsList Called on the start of the game
def onGameEnd() self, argsList Called at the end of the game
def onBeginGameTurn() self, argsList (iGameTurn) Called at the beginning of the end of each turn
def onEndGameTurn() self, argsList (iGameTurn) Called at the end of the end of each turn
def onBeginPlayerTurn() self, argsList (iGameTurn, iPlayer) Called at the beginning of a player's turn
def onEndPlayerTurn() self, argsList (iGameTurn, iPlayer) Called at the end of a player's turn
def onEndTurnReady() self, argsList (iGameTurn) Called when the turn is ready to end
def onFirstContact() self, argsList (iTeamX, iHasMetTeamY) Called when one team meets another team
def onCombatResult() self, argsList (iWinner, iLoser) Called after combat
def onCombatLogCalc() self, argsList (genericArgs) Not sure
def onCombatLogHit() self, argsList (genericArgs) Not sure
def onImprovementBuilt() self, argsList (iImprovement, iX, iY) Called when an improvement is built
def onImprovementDestroyed() self, argsList (iImprovement, iOwner, iX, iY) Called when an improvement is destroyed
def onRouteBuilt() self, argsList (iRoute, iX, iY) Called when a route is built
def onPlotRevealed() self, argsList (pPlot, iTeam) Called when a plot is revealed to a team
def onPlotFeatureRemoved() self, argsList (pPlot, iFeatureType, pCity) Called when a feature is removed on a plot
def onPlotPicked() self, argsList (pPlot) Called when a plot is picked
def onNukeExplosion() self, argsList (pPlot, pNukeUnit) Called when a nuke explodes or a meltdown occurs
def onGotoPlotSet() self, argsList (pPlot, iPlayer) Not sure
def onBuildingBuilt() self, argsList (pCity, iBuildingType) Called when a building is built
def onProjectBuilt() self, argsList (pCity, iProjectType) Called when a project is completed
def onSelectionGroupPushMission() self, argsList (eOwner, eMission, iNumUnits, listUnitIDs) Called when a selection group mission occurs (?)
def onUnitMove() self, argsList (pPlot, pUnit, pOldPlot) Called when a unit moves onto a new plot
def onUnitSetXY() self, argsList (pPlot, pUnit) Called when a unit's coords are set manually
def onUnitCreated() self, argsList (unit) Called when a unit is created
def onUnitBuilt() self, argsList (city, unit, player) Called when a unit is built in a city
def onUnitKilled() self, argsList (unit, iAttacker) Called when a unit is killed by another unit
def onUnitLost() self, argsList (unit) Called when a unit dies
def onUnitPromoted() self, argsList (pUnit, iPromotion) Called when a unit is promoted

Example

This example is a quick idea of what you can do with functions in this file. It causes the "Do you want to change civics" popup to occur.

	def onEndPlayerTurn(self, argsList):
		'Called at the end of a players turn'
		iGameTurn, iPlayer = argsList
		
		if (gc.getGame().getElapsedGameTurns() == 1):
			if (gc.getPlayer(iPlayer).isHuman()):
				if (gc.getPlayer(iPlayer).canRevolution(0)):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_CHANGECIVIC)
					popupInfo.addPopup(iPlayer)


CvAdvisorUtilsCvCameraControlsCvDebugToolsCvDefineEditorCvDiplomacyCvEventManagerCvGameUtilsCvMagGeneratorUtilCvPerfTestCvQuestManagerCvScreenUtilsCvUtilDomPyHelpersPyHelpersScreenImputvector

_DebugTools; PitBoss:

AudioLogParserPbAdminPbWizard

EntryPoints:

CvAppInterfaceCvDebugInterfaceCvDiplomacyInterfaceCvEventInterfaceCvGameInterfaceCvGameInterfaceFileCvMapScriptInterfaceCvOptionScreenCallbackInterfaceCvPopupInterfaceCvRandomEventInterfaceCvScreensInterfaceCvScreenUtilsInterfaceCvTranslatorCvUnitControlInterfaceCvWBInterfacePbMain

pyHelper; pyUnit; pyWB:

PopupUnitUnitEntityCvUnitControllerCvWBDescCvWBPopups

Screens:

CvAdvisorScreenCvCivicsScreenCvCorporationAdvisorCvDanQuayleCvDawnOfManCvDebugInfoScreenCvDomesticAdvisorCvEraMovieScreenCvEspionageAdvisorCvExoticForeignAdvisorCvFinanceAdvisorCvForeignAdvisorCvGFCScreenCvHallOfFameScreenCvInfoScreenCvIntroMovieScreenCvMainInterfaceCvMilitaryAdvisorCvOptionsScreenCvPediaBonusCvPediaBuildingCvPediaCivicCvPediaCivilizationCvPediaCorporationCvPediaFeatureCvPediaHistoryCvPediaImprovementCvPediaLeaderCvPediaMainCvPediaProjectCvPediaPromotionCvPediaReligionCvPediaScreenCvPediaSpecialistCvPediaTechCvPediaTerrainCvPediaUnitCvPediaUnitChartCvReligionScreenCvReplayScreenCvScreenCvScreenEnumsCvSpaceShipScreenCvTechChooserCvTechSplashScreenCvTopCivsCvTutorialQuestScreenCvUNVictoryScreenCvVictoryMovieScreenCvVictoryScreenCvWonderMovieScreenCvWorldBuilderDiplomacyScreenCvWorldBuilderScreenIconGridTechTree

Note: this list is for Beyond the Sword 3.19; other versions may not have all these files.