national Religious wonders

Then I think this may work for you

Spoiler :
Code:
	def cannotConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
## JS Bach Start ##
		eBuildingInfo = gc.getBuildingInfo(eBuilding)
		if eBuildingInfo.getSpecialBuildingType() == gc.getInfoTypeForString("SPECIALBUILDING_CATHEDRAL") or eBuildingInfo.getSpecialBuildingType() == gc.getInfoTypeForString("SPECIALBUILDING_MONASTERY"):
			for iBuilding in range(gc.getNumBuildingInfos()):
				iBuildingInfo = gc.getBuildingInfo(iBuilding)
				if iBuildingInfo.getSpecialBuildingType() == eBuildingInfo.getSpecialBuildingType():
					pPlayer = gc.getPlayer(pCity.getOwner())
					if pPlayer.getBuildingClassCount(iBuildingInfo.getBuildingClassType()) > 0:
						return True
## JS Bach End ##
		return False
 
short cut version :D
Just replace the special building with whatever special building you called your special religious buildings
 
I think that would mean lot more if conditionals and stuff and in the respect of not having to write loads of code mine is more efficient, however that does look like nice code :D
 
Hmm, not sure what you mean by loads of code, cos those 8 lines are enough to settle everything. But, so long as you are happy :D
 
Yeah ;) Thanks for all your help, I can imagine me testing this and being like: "WHATTTTT!!!"

I think I worked out how to fix the original code, because I worked out how the callbacks work and why there are 2...

If a return of false is given to canConstruct then it follows normal rules and the opposite for cannotConstruct. Therefore if I put else: False (if anyother building) It should have worked
 
Not so simple though, as you see, your original code return True for the temples if the player does not have another temple.

As I mentioned, this means:
1) So long as the player does not have the other temples, he can build the named temple without a care for requirements
2) Can have 10 cities building the same named temple
3) Can still begin building the named temple, even if the player has the named temple
 
I guess, a good thing I swapped to cannotConstruct.
 
Both are useful for their own usage

A true in canConstruct allows you to build ignoring all constraints, unless you add some conditions
A true in cannotConstruct prevents you from building under all circumstances, unless you add some conditions.

A false in both cases will still have to check all the requirements
 
Top Bottom