Damirith
Prince
- Joined
- Mar 11, 2015
- Messages
- 379
I want to make a religious wonder, but have it that you cant build it unless you have your own religion. While I know I could just use <holycity> in the xml, I want the wonder to have the freedom to be built in any city in your empire and not just your "holy city". I seared the forums and found some code that I thought would work. Does this make sense to you guys?
Code:
function ReligionRestriction(playerID,buildingTypeID)
local player = Players[playerID];
-- If this isn't the wonder, allow it
if(buildingTypeID ~= GameInfoTypes["BUILDING_MYWONDER"]) then
return true;
end
-- The player has created a religion
if (pPlayer:HasCreatedReligion()) then
return true;
else
return false;
end
end
GameEvents.PlayerCanConstruct.Add(ReligionRestriction);