JFD
Kathigitarkh
I'm trying to get the lua from this thread: http://forums.civfanatics.com/showthread.php?t=498519 to work, but am not sure what I'm doing wrong.
In the log file it says:
Runtime Error: Spain/ConvertOnCapture.lua:7: attempt to index global 'player' (a nil value)
I'm not sure what this means and cannot find any information on the wiki.
Once this is working, I'd like to change it over to convert when a new city is founded instead, which I'd appreciate advice towards.
I'd appreciate any help at all.
Spoiler :
function convertCityOnCapture(oldPlayerID, capital, iX, iY, newPlayerID, conquest1, conquest2)
print("In the convertCityOnCapture code");
player = Players[newPlayerID];
// Make sure the conqueror has the trait and has founded a religion
if(player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_SPAIN"] and player:GetReligionCreatedByPlayer() >= 1) then
// get the city object
city = Map.GetPlot(iX, iY).GetPlotCity();
city:AdoptReligionFully(player.GetReligionCreatedByPlayer());
end
end
GameEvents.CityCaptureComplete.Add(convertCityOnCapture)
print("In the convertCityOnCapture code");
player = Players[newPlayerID];
// Make sure the conqueror has the trait and has founded a religion
if(player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_SPAIN"] and player:GetReligionCreatedByPlayer() >= 1) then
// get the city object
city = Map.GetPlot(iX, iY).GetPlotCity();
city:AdoptReligionFully(player.GetReligionCreatedByPlayer());
end
end
GameEvents.CityCaptureComplete.Add(convertCityOnCapture)
In the log file it says:
Runtime Error: Spain/ConvertOnCapture.lua:7: attempt to index global 'player' (a nil value)
I'm not sure what this means and cannot find any information on the wiki.
Once this is working, I'd like to change it over to convert when a new city is founded instead, which I'd appreciate advice towards.
I'd appreciate any help at all.