SerialEventCityCaptured

From Civilization Modding Wiki
Revision as of 10:23, 14 February 2012 by Killmeplease (talk | contribs) (Created page with "Up: Lua Game Events ==Description== Fired when city is captured '''or traded to an another civ'''. ==Example== ([http://forums.2kgames.com/showthread.php?113029-Reward-for...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Up: Lua Game Events

Description

Fired when city is captured or traded to an another civ.

Example

(by whoward69)

 function OnCityCaptured(hexPos, playerID, cityID, newPlayerID)
   -- Empire destroyed?
   if (Players[playerID]:GetNumCities() == 0) then
     if (Game.GetActivePlayer() == newPlayerID) then
       -- Captured by player
       if (Players[playerID]:IsMinorCiv()) then
         -- It was a minor
       else
         -- It was a major
       end
     else
       -- Captured by AI
     end
   end
 end
 Events.SerialEventCityCaptured.Add(OnCityCaptured)