Python help

Snake Pliskeen

Warlord
Joined
Aug 20, 2003
Messages
170
Location
Italy
I need help from someone good on python compiling because I cant see how to proceed. I need to create the string iturn for manifactured resource and a global pool to accumulate them by time so they can be expended to create military units, as many strategic games, but I cant understand exactly what I have to do. Probably I need to add a new screen for them, but I dont know how. Can someone gimme some suggestions or help?
 
First of all, python is interpreted, not compiled. This means the game read the source code directly and you don't have to deal with a compiler. C++ on the other hand needs to be compiled before the game can use it. Most modders use python to avoid using the compiler. Compiling means faster execution time and it catches some errors while compiling even before you start the game.

I need to create the string iturn for manifactured resource and a global pool to accumulate them by time so they can be expended to create military units, as many strategic games, but I cant understand exactly what I have to do.
Python can use (some) existing variables and if it adds new ones, they are generally speaking temporal, meaning they are lost once the function call ends. In order to get a new persistent variable, which even goes into the savegame, then you need to use C++. Also there is a risk that you would need transmitting data for this new variable in network games (avoiding desyncs), but it's likely avoidable if you hook into the code of building new units since vanilla already transmits this on networks.

You should likely add an array of resources to CvPlayer, add contents from plot groups to player in doTurn, check that the player has the needed resources in canBuildUnit (or whatever it's called) and then subtract when actually building the unit. CvUnitInfo will likely need a new tag, or list of tags to tell the amount of resources needed to build said unit. All this requires to be in the DLL, or at least most of it.

You need to consider when to use the resource related to constructing a unit. Should it use the resource when the unit is added to the queue or when it's finished and should it be possible to add the unit to the queue if you lack the resource in question. Most likely it would be easiest to implement that adding will use the resource, but then what about repeated construction and what if construction is canceled?

Probably I need to add a new screen for them, but I dont know how.
New screens are added in python, but it's also possible to mod existing screens to display what you want.
 
Thank you very much! You clarify to me a lot of things, especially the most important: I doubt I can do all this! :lol:
If someone want to help me he's welcome! :goodjob:
 
Top Bottom