Check for Victory Condition Option

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
Hopefully this is an easy one. I want to do a python check to see if a specific victory condition option has been set to True. Now I know how to do a check for a game option. For example, if I wanted to check for the game option "Choose Religions":

Code:
if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):

My question is: How can I do a check for a victory condition option like Domination, Cultural or Religious? The Religious option is the one I really want.

Respectfully,

Orion Veteran :cool:
 
Try this totally untested code:

Code:
if CyGame().isVictoryValid(VictoryTypes.VICTORY_DIPLOMATIC):
    # wheeee!

By "Religious" victory condition, do you mean AP vote? I don't know that you can even choose between UN versus AP for disabling only one victory, but the above is for Diplomatic which includes both UN and AP.

BTW, do you know about the online Civ4 Python API? That's where I found this information by searching for "Victory" on the page until I saw something that looked promising.
 
Try this totally untested code:

Code:
if CyGame().isVictoryValid(VictoryTypes.VICTORY_DIPLOMATIC):
    # wheeee!

Nope: I tried the following, but it did not get passed the line. A religious victory option is set to true for the game I am testing.

Code:
if CyGame().isVictoryValid(VictoryTypes.VICTORY_RELIGIOUS):

This line will determine if the victory actually has been achieved. That's not what I want.

Code:
if CyGame().isVictoryValid(gc.getInfoTypeForString("VICTORY_RELIGIOUS")):


By "Religious" victory condition, do you mean AP vote?

No. Just the options selected at the start of the game.

BTW, do you know about the online Civ4 Python API?

Yea, I do, but keep forgetting to save as a favorite. It's a favorite now.

Very Respectfully,

Orion Veteran :cool:
 
What does typing

print gc.getInfoTypeForString("VICTORY_RELIGIOUS")​

into the Civ4 console (~) show? Do you get -1 or a number > 0? If -1, then that isn't a valid identifier. It's not listed in the API, but the API was run against 3.13.

Did you add this victory type in your mod? When I start a new game, there is no victory checkbox called Religious. Again, I'm running 3.13.
 
This line is tested and valid, as it currently checks for my religious victory condition in the Orion's Inquisition Mod. When I win the game these lines work:

Code:
if CyGame().isVictoryValid(gc.getInfoTypeForString("VICTORY_RELIGIOUS")) :
        CyGame().setWinner(pPlayer.getTeam(), gc.getInfoTypeForString("VICTORY_RELIGIOUS"))


Guess what? After restarting the game this line worked! :crazyeye:
Code:
if CyGame().isVictoryValid(gc.getInfoTypeForString("VICTORY_RELIGIOUS")) :

I moved this to near the begining of the entire function, because I wanted this check to run first.

Note: I forgot to tell you I am running BTS 3.17.

Respectfully,

Orion Veteran :cool:
 
Top Bottom