GameEvents.CityConvertsReligion (Civ5 API)

From Civilization Modding Wiki
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 GameEvents.

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

  • This method was added in Gods & Kings.


Usage

void GameEvents.CityConvertsReligion(PlayerID owner, ReligionType religion, int x, int y)


Event Type

Unknown

Parameters

owner: No description available.
religion: No description available.
x: No description available.
y: No description available.


Source code samples

Too many occurences. Only 50 out of 1 are listed.

TurnsRemaining.lua (G&K)

DLC/Expansion/Scenarios/MedievalScenario/TurnsRemaining.lua
0711
GameEvents.CityConvertsReligion.Add(function(iOwner, eReligion, iX, iY)
0713
-- Only matters if switched to Protestant
0714
if (eReligion == 13) then
0715
local pPlayer = Players[iOwner];
0716
local civType = pPlayer:GetCivilizationType();
0717
if (civType == GameInfo.Civilizations["CIVILIZATION_FRANCE"].ID or
0718
civType == GameInfo.Civilizations["CIVILIZATION_CELTS"].ID or
0719
civType == GameInfo.Civilizations["CIVILIZATION_ENGLAND"].ID or
0720
civType == GameInfo.Civilizations["CIVILIZATION_SPAIN"].ID or
0721
civType == GameInfo.Civilizations["CIVILIZATION_NETHERLANDS"].ID or
0722
civType == GameInfo.Civilizations["CIVILIZATION_AUSTRIA"].ID or
0723
civType == GameInfo.Civilizations["CIVILIZATION_SWEDEN"].ID) then
0725
if (pPlayer:HasReligionInMostCities(eReligion)) then
0726
local bChangeMade = false;
0727
if (civType == GameInfo.Civilizations["CIVILIZATION_FRANCE"].ID) then
0728
if (GetPersistentProperty("FranceCatholic") == 1) then
0729
SetPersistentProperty("FranceCatholic", 0);
0730
bChangeMade = true;
0731
end
0732
elseif (civType == GameInfo.Civilizations["CIVILIZATION_CELTS"].ID) then
0733
if (GetPersistentProperty("CeltsCatholic") == 1) then
0734
SetPersistentProperty("CeltsCatholic", 0);
0735
bChangeMade = true;
0736
end
0737
elseif (civType == GameInfo.Civilizations["CIVILIZATION_ENGLAND"].ID) then
0738
if (GetPersistentProperty("EnglandCatholic") == 1) then
0739
SetPersistentProperty("EnglandCatholic", 0);
0740
bChangeMade = true;
0741
end
0742
elseif (civType == GameInfo.Civilizations["CIVILIZATION_SPAIN"].ID) then
0743
if (GetPersistentProperty("SpainCatholic") == 1) then
0744
SetPersistentProperty("SpainCatholic", 0);
0745
bChangeMade = true;
0746
end
0747
elseif (civType == GameInfo.Civilizations["CIVILIZATION_NETHERLANDS"].ID) then
0748
if (GetPersistentProperty("NetherlandsCatholic") == 1) then
0749
SetPersistentProperty("NetherlandsCatholic", 0);
0750
bChangeMade = true;
0751
end
0752
elseif (civType == GameInfo.Civilizations["CIVILIZATION_AUSTRIA"].ID) then
0753
if (GetPersistentProperty("AustriaCatholic") == 1) then
0754
SetPersistentProperty("AustriaCatholic", 0);
0755
bChangeMade = true;
0756
end
0757
elseif (civType == GameInfo.Civilizations["CIVILIZATION_SWEDEN"].ID) then
0758
if (GetPersistentProperty("SwedenCatholic") == 1) then
0759
SetPersistentProperty("SwedenCatholic", 0);
0760
bChangeMade = true;
0761
end
0762
end
0764
if (bChangeMade) then
0765
local popupInfo = {
0766
Data1 = 500,
0767
Type = ButtonPopupTypes.BUTTONPOPUP_TEXT,
0768
}
0769
if (Game.GetActivePlayer() == iOwner) then
0770
local pProtestantHolyCity = Game.GetHolyCityForReligion(GameInfoTypes["RELIGION_PROTESTANTISM"], -1);
0771
popupInfo.Text = Locale.ConvertTextKey("TXT_KEY_MEDIEVAL_SCENARIO_YOU_ADOPTED_PROTESTANTISM", pProtestantHolyCity:GetName());
0772
else
0773
popupInfo.Text = Locale.ConvertTextKey("TXT_KEY_MEDIEVAL_SCENARIO_OTHER_ADOPTED_PROTESTANTISM", pPlayer:GetName());
0774
end
0775
UI.AddPopup(popupInfo);
0776
end
0777
end
0778
end
0779
end
0780
end);



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.