nothing for onChangeTile or cityupdate??

naf4ever

Dread Lord
Joined
Feb 8, 2003
Messages
405
Location
Southeast Washington State
I notice theres no event to interrupt when i change the working tiles around in my city. For example in my case im trying to make something happen when you put a worker on a tile with a watermill yet i dont see which event would correpond to this. The next best thing if i cant do this is if there is an event that gets triggered after you makes changes in the city screen then exit it. But i dont see this either.

I do see this in the event manager:
Code:
def onCityDoTurn(self, argsList):

But im unsure what it does. Anyone have ideas for either of these?

-Naf
 
naf4ever said:
I notice theres no event to interrupt when i change the working tiles around in my city. For example in my case im trying to make something happen when you put a worker on a tile with a watermill yet i dont see which event would correpond to this. The next best thing if i cant do this is if there is an event that gets triggered after you makes changes in the city screen then exit it. But i dont see this either.

I do see this in the event manager:
Code:
def onCityDoTurn(self, argsList):

But im unsure what it does. Anyone have ideas for either of these?

-Naf

onCityDoTurn() is proccessed every turn for every city. I use it to perform actions based on buildings and units in the city though you can of course do whatever you want with it.

Im not understanding what you are trying to do. But you can put an event into the improvementBuilt if you want to trigger something when the watermill is created or onMove if you want to take an action when the worker enters a tile with a watermill.
 
There's a nasty hack you can do which might work. In CvMainInterface.py the updateCityScreen function is called every time something changes in the city screen. You may be able to patch into this.

Don't know if it would work with the AI though - you might be able to get around it with a slightly less accurate method... the play would probably never notice.

What is it you want to do exactly?
 
Oh im trying to get an event triggered when i assign a city population to work a tile. For example in this picture:

tile.jpg


The red circle has a watermill on it but isnt being worked currently. I was wondering if there's a way to trigger an event once i assign a citizen to work that tile.
 
naf4ever said:
Oh im trying to get an event triggered when i assign a city population to work a tile. For example in this picture:

tile.jpg


The red circle has a watermill on it but isnt being worked currently. I was wondering if there's a way to trigger an event once i assign a citizen to work that tile.

I doubt it, and tying events to item selections is typically dodgy anyway because the AI doesn't select like a human player does (and it could be exploitable for players that would select and deselect workers to work that tile multiple times).

You would probably be best to put the check in onCityDoTurn and have the city read its fat cross, check for the worked watermill and then perform whatever action you are looking for.

What do you want it to do when you start working the tile?
 
Im working on an improvement for watermills and workshops. The mod works so far but i got them linked to onBeginPlayerTurn right now. It checks for how many of each improvement is in the fatcross and if they are being worked. If so the city then gets a small % bonus to either production (for the workshop) or gold (for the watermill).

Hmm, when does onCityDoTurn get processed? I notice tech research gets done after onBeginPlayerTurn but before onEndPlayer Turn. I havent figured out yet what phase in the turn a worker finishing construction of an improvement gets registered.
 
naf4ever said:
Im working on an improvement for watermills and workshops. The mod works so far but i got them linked to onBeginPlayerTurn right now. It checks for how many of each improvement is in the fatcross and if they are being worked. If so the city then gets a small % bonus to either production (for the workshop) or gold (for the watermill).

Hmm, when does onCityDoTurn get processed? I notice tech research gets done after onBeginPlayerTurn but before onEndPlayer Turn. I havent figured out yet what phase in the turn a worker finishing construction of an improvement gets registered.

omEndPlayerTurn is processed at the end of "Upkeep" but before the player takes any of his actions. Its badly named. Basically the game runs through all of its upkeep functions, then turns the round over to the player to do his stuff. There isn't any function that runs at the true end of a players turn (the closest you will get to that is to put a check in the next players onBeginPlayerTurn).
 
Ya i discovered that through lots of trial and error. BTW you never mentioned when onCityDoTurn is processed?

EDIT: It appears onCityDoTurn does stuff about the same time as onEndPlayerTurn.

So then what is the advantage of using onCityDoTurn over onEndPlayer turn that has the

Code:
for i in range(player.getNumCities()):
function?
 
Lets see:

1. onBeginGameTurn python event
2. update the score
3. do all the deals
4. player do turns:
[tab]a. onBeginPlayerturn python event
[tab]b. all the maintenance stuff:
[tab][tab]i. revolution
[tab][tab]ii. conversion
[tab][tab]iii. conscript
[tab][tab]iv. earn money
[tab][tab]v. get research
[tab][tab]vi. go through each of the cites and perform their do turns
[tab][tab]vii. figure out golden ages
[tab][tab]viii. figure out anarchy
[tab][tab]ix. get the civics
[tab][tab]x. update the trade routes
[tab][tab]xi. update war weariness
[tab]c. onEndPlayerTurn python event
5. make barbarian cities
6. make barbarian units
7. perform global warming
8. ?
9. do the voting council thing
10. onEndGameTurn python event
11. Players are given the chance to perform all their actions.

I think thats the way it works. Don't hold me to it.
 
Wow! This list is extremely useful. That helps, thanks again. Im surprised this isnt posted on any of the tutorials or what not. Also am i to assume that production gets processed during onCityDoTurn ?

On an unrelated note i found out trying to .changeResearchProgress() during onEndGameTurn seems to never fail to cause out of sync errors if it results in a tech gain. I dont think the game likes to have stuff done at Begin and End GameTurn.
 
naf4ever said:
Wow! This list is extremely useful. That helps, thanks again. Im surprised this isnt posted on any of the tutorials or what not. Also am i to assume that production gets processed during onCityDoTurn ?

Specifically onCityDoTurn is a python function, its not processed there. But yes, city production is processed between 4.b.v and 4.b.vi in the list. Basically all of the city maintenance stuff is handled before the onCityDoTurn python event kicks off.
 
Kael, is the onPlayerBeginTurn python event called before the city maintenance stuff is handled?
 
TheLopez said:
Kael, is the onPlayerBeginTurn python event called before the city maintenance stuff is handled?

Yeap, just as in the order above. So if you don't want a maintenance effect from a building you are better to remove it during onPlayerBeginTurn instead of waiting for OnCityDoTurn.
 
Back
Top Bottom