Removing Buildings/Units from Build Queue Using Python

Lplate

Esus (Allegedly)
Joined
Feb 8, 2011
Messages
578
Location
Ireland
Hi, does anyone know how I can remove an item from the build list for a city using python.
In my mod, hammers towards the construction of certain buildings and units are transferred from one city to another.
The original city still includes the building/unit in it's build queue. This is fine in most cases but where the building in question is a world wonder or from a unit class which only allows a certain number, then one turn of construction can be lost.
Note: the city from which the hammers are transferred is converted to a Settlement (similar to FFH Kuriotates) so the player can not manually remove the wonder/hero from the city's build queue.

In the following turn, the construction of the wonder/hero can continue using all of the transferred hammers.

I'd like to remove the wonder/hero from the original build queue so that the turn of construction is not lost.
 
You can remove the current item in the production queue via something like "pCity.popOrder(0, false, true)" since the first argument for that is the order number and order number 0 is the one that is currently being worked on.

If you want to search the entire queue, there are a variety of CyCity member functions involved like getOrderQueueLength, getOrderFromQueue, and the already mentioned popOrder.

Look at the Python API, which you can get to via the Modiki (or directly, here) for more details on the calls.
 
Thanks, I'll try that when I get a chance to mod again.
 
Back
Top Bottom