SpecificCityInfoDirty: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Created page with "Fired when something in a particular city was changed. Example (from SmoothCityBanner v.2 mod): function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType) if (eUpdate...")
 
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Fired when something in a particular city was changed.
Up: [[Lua Game Events]]


Example (from SmoothCityBanner v.2 mod):
 
function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
==Description==
    if (eUpdateType == [[http://modiki.civfanatics.com/index.php/Lua_Game_Objects/CityUpdateTypes|CityUpdateTypes]].CITY_UPDATE_TYPE_BANNER) then
Fired when something in a particular [[Lua Game Objects/City|city]] was changed.
        local playerTable = Instances[ iPlayerID ];
E.g. building created/sold, specialists reallocated, and some other things.
        if playerTable == nil then
 
            return;
==Example==
        end
(from SmoothCityBanner v.2 mod):
        local instance = playerTable[ iCityID ];
 
        if instance == nil then
  function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
            return;
      if (eUpdateType == [[Lua Game Objects/CityUpdateTypes|CityUpdateTypes]].CITY_UPDATE_TYPE_BANNER) then
        end
          local playerTable = Instances[ iPlayerID ];
    RefreshCityBanner(instance);
          if playerTable == nil then
    end
              return;
end
          end
Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);
          local instance = playerTable[ iCityID ];
          if instance == nil then
              return;
          end
      RefreshCityBanner(instance);
      end
  end
  Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);

Latest revision as of 10:04, 15 February 2012

Up: Lua Game Events


Description

Fired when something in a particular city was changed. E.g. building created/sold, specialists reallocated, and some other things.

Example

(from SmoothCityBanner v.2 mod):

 function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
     if (eUpdateType == CityUpdateTypes.CITY_UPDATE_TYPE_BANNER) then
         local playerTable = Instances[ iPlayerID ];
         if playerTable == nil then
             return;
         end
         local instance = playerTable[ iCityID ];
         if instance == nil then
             return;
         end
     RefreshCityBanner(instance);
     end
 end
 Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);