Androrc the Orc
Emperor
Is it possible to change civilization or leader ingame? And how about changing which city-state a CIVILIZATION_MINOR player is ingame?
Is it possible to change civilization or leader ingame?
Well... depends on how you define civilization and leader. Let's take leader for example:
If you mean changing between leaders as defined by the xml files...then no.
But if "leader" is defined as the text and pictures shown to the human player (via UI) plus some Lua controlled AI behavior...then yes you can.
Same for civilization.
One other question, is it possible to raze certain cities automatically? For instance, if I wanted the cities of certain city-states to be razed automatically if conquered.
Yes, in Lua. Just make a city capture event trigger that razes the city automatically using the Player:Raze(cityID) function. Note, though, that the AI won't understand this process; it'll think that it's trying to capture the city intact and won't understand why the city just disappeared.
function AcquireCity( pCity, bConquest, bTrade )
local player = Players[pCity:getOwner()];
if (bConquest) then
if (player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_BATAVIANS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_GELEONTES"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_SAXONS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_TUPINIQUIM"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_UIGHURS"].ID) then
pCity:kill();
end
end
end
GameEvents.PlayerAcquireCity.Add( AcquireCity )
Do you know the name of the city capture event trigger?
function RazeTribalSettlement(playerID, bCapital, iX, iY, newPlayerID)
local player = Players[playerID]
local city = Map.GetPlot(iX,iY):GetPlotCity();
if (player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_BATAVIANS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_GELEONTES"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_SAXONS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_TUPINIQUIM"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_UIGHURS"].ID) then
city:Kill();
end
end
GameEvents.CityCaptureComplete.Add(RazeTribalSettlement)
function RazeTribalSettlement(playerID, bCapital, iX, iY, newPlayerID)
local player = Players[playerID]
[COLOR="Red"]local newplayer = Players[newPlayerID][/COLOR]
local city = Map.GetPlot(iX,iY):GetPlotCity();
if (player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_BATAVIANS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_GELEONTES"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_SAXONS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_TUPINIQUIM"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_UIGHURS"].ID) then
[COLOR="Red"]newplayer:Raze(city);[/COLOR]
end
end
GameEvents.CityCaptureComplete.Add(RazeTribalSettlement)
But then, nothing happened upon city conquest.
function OnCityCaptured(hexPos, playerID, cityID, newPlayerID)
local player = Players[playerID]
local newplayer = Players[newPlayerID]
local city = Map.GetPlot(ToGridFromHex(hexPos)):GetPlotCity();
if (player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_BATAVIANS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_GELEONTES"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_SAXONS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_TUPINIQUIM"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_UIGHURS"].ID) then
city:Kill();
end
end
GameEvents.SerialEventCityCaptured.Add(OnCityCaptured)