national wonder help

Joined
Jul 5, 2004
Messages
23,562
Location
Canberra, Australia
Is there any way to tell if a building is a national wonder in Python? isWorldWonderClass does this for world wonders but I cant see documentation for an isNationalWonderClass or equivalent.

Is there a way of identifying buildings a city has been given for free for example from a world wonder? isBuildingFree(BuildingType iIndex) on CyPlayer appears in the documentation so I may just have answered my own question :)

Is there a function which returns the building class that a wonder (national or world) gives for free?
 
This is a list of most of the known python calls:

Civ4 Python API

I think this would work:
getMaxPlayerInstances ()

Something like
Code:
iBuilding = gc.getTypeForString(BUILDING_NAMEOFBUILDING)
if( iBuilding.getMaxPlayerInstances() = 1):
would determine if something was a national wonder or not.
 
This is a list of most of the known python calls:

Civ4 Python API
Thanks. That link was the documentation I was talking about :). I am trying to get the free building bit working first for the abandon city mod. The national wonder stuff is for a couple of other mini mods I am thinking on. I find it best for me to have multiple things going at once.
 
I cant get the free building thing to work. I am using isBuildingFree on CyPlayer but there does not appear to be a getBuildingType on building so I used getBuildingClassType but it is wrong. Any suggestions?
 
I can't really understand what you're saying. Could you be more specific about what you're trying to do? It would also be helpful to post the code you have written (remember to nest it in [code]code goes here[/code] tags).
 
Here's the relationship between building classes and build types. A building class defines a general class of buildings, e.g. Markets. Each civilization can have a unique building for each class (UB), e.g. Mint, or use the default building type, e.g. a Market.

Building classes are never built--only building types. To determine which building type a player will build, you must ask its CvCivilizationInfo using getCivilizationBuildings(<building-class>). This function returns the <building-type> that the civ uses for the given <building-class>.

Code:
player = gc.getActivePlayer()
civ = gc.getCivilizationInfo(player.getCivilizationType())
for iClass in range(gc.getNumBuildingClassInfos()):
    iType = civ.getCivilizationBuildings(iClass)
    if player.isBuildingFree(iType):
        # it's free!
 
Excellent. Thank you. It is now working. @phungus420, sorry for being vague attribute it to old age :). However it is a trait that I have always had - I don't like writing and I tend to be too brief. As opposed to when I waffle on like now. One extreme or the other never a happy medium :)
 
Top Bottom