Events.SerialEventCityCreated (Civ5 API)

From Civilization Modding Wiki
Revision as of 18:47, 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).


Function.png This function is a member of Events.

This is a static method, invoke it with a dot.


This event is triggered when a city is created.


Usage

void Events.SerialEventCityCreated(Vector2 vHexPos, PlayerID player, CityID cityID, ArtStyleType artStyleType, EraType eraType, int continent, int populationSize, int size, int fogState)


Event Type

Regular event: you can subscribe to it through Events.SerialEventCityCreated.Add(<function handler>) or invoke it directly through Events.SerialEventCityCreated(<arguments list>).

Parameters

vHexPos: Vector3 containing city x,y,z coordinates which can be converted to map coordinates with the ToGridFromHex function
e.g. local iX, iY = ToGridFromHex( vHexPos.x, vHexPos.y )
player: ID of the player who owns the created city; index into global Players table
cityID: ID of the city that was created; note IDs are specific to player and not truly unique
artStyleType: art style of city graphics; compare with types from ArtStyleTypes table (e.g. GameInfoTypes.ARTSTYLE_ASIAN)
eraType: era of city graphics; compare with types from Eras table (e.g. GameInfoTypes.ERA_ANCIENT)
continent: ID of continent where city is located
populationSize: unknown; name based on reference in original game files (UnitFlagManager.lua and CityBannerManager.lua)
size: unknown; name based on reference in original game files (UnitFlagManager.lua and CityBannerManager.lua)
fogState: visibility of this city for Active Player
0 = tile completely hidden by FoW
1 = tile revealed but not currently in vision
2 = tile in vision


Source code samples

Redundant occurences have been removed.

CityBannerManager.lua

UI/InGame/CityBannerManager.lua
0650
Events.SerialEventCityCreated.Add( OnCityCreated );


CityList.lua

UI/InGame/CityList.lua
0073
Events.SerialEventCityCreated.Add( OnChangeEvent );



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.