Events.SerialEventImprovementDestroyed (Civ5 API)

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


Like SerialEventImprovementCreated, this event is triggered whenever an improvement appears on a player's map, as a result of an improvement being created on a tile already been discovered by the active player, or a tile being discovered that already hosts an improvement. Barbarian camps and ancient ruins count as improvements, as listed on the Improvement table. A completed improvement replacing an improvement in progress will not trigger this event.


Usage

void Events.SerialEventImprovementDestroyed(int hexX, int hexY, int continent1, int continent2)


Event Type

Unknown

Parameters

hexX: No description available.
hexY: Hex y-coordinate of the tile the road was built on which can be converted to map grid coordinates with the ToGridFromHex function (see example)
continent1: These values appear to always be the same and also seem to refer to the continent on which the improvement was destroyed. Different land masses will have different numbers corresponding to their graphic set, and oceans will be marked as 0.
continent2: No description available.


Examples

function onImprovementDestroyed(iHexX, iHexY, iContinent1, iContinent2)
local pPlot = Map.GetPlot(ToGridFromHex(iHexX, iHexY))
local plotOwner = pPlot:GetOwner() > -1 and Players[pPlot:GetOwner()]:GetName() or "nobody"
print(string.format("Improvement destroyed on tile %d, %d by player %d. Plot owned by %s", pPlot:GetX(), pPlot:GetY(), iPlayerID, plotOwner))
end
Events.SerialEventImprovementDestroyed.Add(onImprovementDestroyed)


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.