• 📚 A new project from the admin: Check out PictureBooks.io, an AI storyteller that lets you build custom picture books for kids in seconds. Let me know what you think here!

Is there any way to count things, like Cities Razed

notque

Artificially Intelligent
Joined
Nov 13, 2005
Messages
2,200
I'm trying to add traits to leaders based on criteria. One of the Criteria I want to do is adding a trait based on how many cities a Civ has razed.

Is that possible? How do you count things, and save the count?

Thanks.
 
You could do this in onCityRazed in CvEventManager.py. To count things, just create a variable to store the count in. Python won't remember the value of the local variable when it exits onCityRazed, so the variable needs to either be declared as a global variable or imported into CvEventManager from your mod. If you are unfamiliar with these things, there is a lot of info out there. A good place to start would be Python.org.
 
When you start a new game your variables are initialized to whatever value you use to define them. Loading or saving the game doesn't change their values. There is something called ScriptData that can be used to save your data within a saved game.
 
Back
Top Bottom