Getting the number of religions in a city.

JFD

Kathigitarkh
Joined
Oct 19, 2010
Messages
9,132
Location
The Kingdom of New Zealand
Is there a method that I can use in order to get the number of different religions in a city? There doesn't seem to be anything directly available for this, and I'm not sure how I might indirectly go about this. Thanks.
 
Is there a method that I can use in order to get the number of different religions in a city? There doesn't seem to be anything directly available for this, and I'm not sure how I might indirectly go about this. Thanks.

You can probably loop through all religions (skipping ID = 0 because that's a pantheon) and count them by checking which religions have more than 0 followers in the city, something like:

Code:
local rCount = 0
for pReligion in GameInfo.Religions() do
	iReligionID = pReligion.ID;
	if (iReligionID > 0) then
		if pCity:GetNumFollowers(iReligionID) > 0) then
			rCount = rCount + 1
 
Back
Top Bottom