Check if a wonder is built

ExCx

Chieftain
Joined
Apr 5, 2012
Messages
40
Location
Istanbul, Turkey
Hi, I'm trying to accomplish this. But no one answered so I will do it myself. I don't have any knowledge on Python. But I believe I can put together the code if explained seperetaly.

So, first thing I should do is to check if the "Olympic Games" wonder is built and still exists. How can I do that? And where in the CvEventManager?
 
well a check for the Games in OnBuildingBuilt and onCityAcquired/Razed should do it. Though I would help I don't have the time right now, but if nobody has replied in a few days I will help
 
Built alone is easy, dont even need onBuildingBuilt

Built and exist is tougher.
Besides Built and Raze like jamie mentioned, most likely you need onGameLoad and onGameStart as well to keep the data somewhere.
Or use the 3rd party python method jamie using
 
unfortunalty Baldyr's data storage also is initiated on onGameLoad, Start and possibly save
 
Maybe it's possible to use:

INT getBuildingClassCreatedCount (BuildingClassType eIndex)
int (BuildingClassType) - building Class count

Since it's a wonder, built = 1, not built = 0.

Yup! That's the best way to confirm a player has a specified building class:

Code:
if (pPlayer.getBuildingClassCount(iBuidlingClass)>0):

It's a one line verification, which is very efficient.

If true, then the player has the building.
 
Nope, he wants to check if the wonder is built and still exist by ANY player.
You will have to loop through all players to check
 
ahhh God-Emperor, you never fail to impress me with your knowledge :lol:
 
As God-Emperor said, the line of code to check for just the wonder is:

Code:
if (CyGame().getBuildingClassCreatedCount(iBuildingClass) > 0):

So there you have it. You can check for a single wonder or check for a building class by the player.

Code:
if (pPlayer.getBuildingClassCount(iBuidlingClass)>0):
 
Nope again, as mentioned, he wants to check if the wonder is built and still existed.
That code will only check if it was ever built, but even if the wonder was razed, that code will still give a true value
 
Nope again, as mentioned, he wants to check if the wonder is built and still existed.
That code will only check if it was ever built, but even if the wonder was razed, that code will still give a true value

:nono: Use the line I posted!

Code:
if (pPlayer.getBuildingClassCount(iBuidlingClass)>0):

Do a loop through all the players and use the line to run a check against each player. If the line comes back true for any player, then the wonder has been built and still exists. If the line returns false for every player, then the wonder has not been built yet, or was razed. This approach will work. :smug:
 
Back
Top Bottom