View Full Version : Python - changing plots worked by cities


The Great Apple
Apr 01, 2006, 08:59 PM
Firsty - I'm not up at 4am because of this, I'm up at 4am because I am going to watch the Grand Prix. Not really an excuse...

Anyway, I've been trying to work out how to assign plots for a city to use through python. It hasn't been going well.

The function I've been trying to use is CyCity.alterWorkingPlot(iIndex) - where iIndex is the plot index. It's the only one I can seem to find that might do something. At the moment I'm having very limited success. I can't seem to figure out quite what the function does, if it does anything at all, so I thought I'd throw the problem out here and see if anybody can think of a solution.

The only this I can think of is maybe that it's a glitch with the plot index function. I say this because CyCity.isWorkingPlot(CyPlot) returns corrent values for if the plot is worked by the city, while CyCity.isWorkingPlot(iIndex) doesn't, often saying alot more plots are worked that actually are.

Any ideas/suggestions? Is there a function I've missed?

TheLopez
Apr 01, 2006, 10:26 PM
Firsty - I'm not up at 4am because of this, I'm up at 4am because I am going to watch the Grand Prix. Not really an excuse...

Anyway, I've been trying to work out how to assign plots for a city to use through python. It hasn't been going well.

The function I've been trying to use is CyCity.alterWorkingPlot(iIndex) - where iIndex is the plot index. It's the only one I can seem to find that might do something. At the moment I'm having very limited success. I can't seem to figure out quite what the function does, if it does anything at all, so I thought I'd throw the problem out here and see if anybody can think of a solution.

The only this I can think of is maybe that it's a glitch with the plot index function. I say this because CyCity.isWorkingPlot(CyPlot) returns corrent values for if the plot is worked by the city, while CyCity.isWorkingPlot(iIndex) doesn't, often saying alot more plots are worked that actually are.

Any ideas/suggestions? Is there a function I've missed?

TGA, it is working for me. I am correct to assume that you are testing it using something like:

objCity.alterWorkingPlot(0)

Using 0 is like clicking on the city, optimizes the placement of the citizens, etc.

If you are you need to start at 1. Here is a map of the plot index values relative to the city:
http://www.aracnet.com/~opus/Civiv/cityplots.jpg

If you want a citizen at plot index 1 then:

objCity.alterWorkingPlot(1)


if there is already a citizen at plot 1 and you want to programatically remove them, then use the same code.

I hope this helps.

The Great Apple
Apr 02, 2006, 12:04 AM
Aaaah - so the index is relative to the City, not the global plot index.

Thanks!