build buildingType:level[:optional quantity]
academy - a
With this goal, you are able to instruct your bot to create and upgrade buildings in your city. Build is a target, it is used to tell the bot the final quantity of buildings and levels you want in the city. For example, if you had 8 cottages in the city and wanted 9 then you would tell the bot to build 9 cottages rather than 1 more cottage. Assuming you wanted them each at level 10, you could write this as:
Alternatively, if you had 9 cottages and wanted only 8 you would tell the bot you wanted 8 cottages rather than tell it to demolish just 1 more. Setting a building level of 0 will tell the bot to demolish the building since you want it at level "0". This would be written as:
If a building upgrade requires a prerequisite building to be completed, the bot will automatically build and upgrade the prerequisite building with priority; e.g., to upgrade a cottage to level 9, you need townhall level 8 first. The bot would upgrade the townhall to level 8 before completing a cottage build to level 9. Research goals that require a building to be completed will also be built with priority; e.g., to research machinery to level 1, the bot will build and upgrade your academy to level 9 with priority. Make sure your research goals are sensibly ordered so that you get the basics built before trying to start on level 1-9 academy!
When a prerequisite is not pending, and multiple buildings are in the same (next) goal line, then the bot will work on the fastest ones first. For example, if you had:
...then you've instructed the bot to build a total of 15 barracks at level 4, and a total of two barracks at level 9. The bot would get all barracks to level 4 first since working on those would be faster than upgrading two of them to level 5. It should be noted that since these goals are a target, the previous goal line would not tell the bot to build a total of 17 barracks. It's still a total of 15 barracks... building 15 barracks at level 4 is still considered "completed" even if you upgrade two of those higher to level 9.
By default the bot sets config building:1 internally if you have any build goal lines present. If you wish to disable all construction for a city temporarily, instead of adding a // or # to each build line, you can simply add config building:0 to goals.
In the 1st example above, the bot will build and upgrade a total of fifteen barracks to level 9, space permitting. In the 2nd example above, the bot will build and upgrade fifteen barracks to level 9, eight cottages to level 9, and forty sawmills to level 9, space permitting. When you've given the bot a goal to build more things than it has room for, for example fifteen barracks to level 9 when there's only fourteen slots to build barracks in, then it will build the ones it's able to and go on to the next line below it. If at any time later a slot gets cleared, it will backtrack to the previous line and build that missing barrack. When a building cannot have multiple of it's type and there's no slot available to build it, then the bot stops with the message of "Needs space: xxx" in the building tab. The same happens if the bot needs space to build a prerequisite for the building on the current goal line. For example if you tell the bot to build a stable, then it will need a farm at level 5. If it has no farm or room for a farm, it will say "Needs space: farm" and stop there until you fix the problem.
As with the troop goals, the bot performs multiple build lines in sequential order. As explained above, when building something that allows multiple of that building type (e.g. barracks/resource buildings/warehouses/cottages) it will skip to the next line(s) and continue until a slot is freed up to build on. Using this method, you can arrange goals to optimize the conversion of a npc10 in a few simple lines, e.g.:
build b:9:15 build c:0:9 build st:0:0 build fo:0:0 build ws:0:0 build s:9:40 build f:0:0 build q:0:0 build i:0:0
With the above goals, the bot will demolish all but 9 cottages, demolish the stable/forge/workshop, and replace each slot one by one as it opens with a level 9 barrack until it has a total of 15 barracks at level 9. Once the inside of the city is complete it would move on to the resource fields. The bot would demolish all the farms, the quarry, and the iron mine, and replace them one by one as each slot opens with a level 9 sawmill until it had a total of 40 sawmills at level 9.
The bot will demolish and upgrade the lowest level of a certain building first to complete its goals. For example: if you have eight level 9 barracks, one level 8 barrack, two level 7 barracks, and one level 1 barrack and you tell the bot to build b:9:12, then the bot will first upgrade the level 1 barrack to match the two at level 7, then it will upgrade all three of those level 7 barracks to level 8, then it will upgrade all four of the level 8 barracks to level 9.
The bot will not demolish or downgrade any buildings to meet goals unless the building level or quantity is set to 0. For example: if you have a total of 16 barracks, fourteen at level 9 and two at level 10, and you set build b:9:15 for a goal, the bot will not demolish or downgrade any barracks. If you changed it instead to b:9:16 for a goal, it will not downgrade the two level 10 barracks to level 9 just because the goal says 9. If you changed the goal instead to b:0:15, THEN the bot would demolish one of the level 9 barracks and leave the two at level 10 plus thirteen more of the level 9s alone.
Using a quantity of 0 on a building will downgrade all buildings of that type until none are equal to the specified level. For example build inn:2:0 tells the bot you want 0 inns level 2 or higher. So it will demolish the inn one level at a time until it's not level 2 or higher (e.g. it will downgrade your inn to level 1). This works with multiple buildings too: build i:5:0 would downgrade all iron mines until none of them were level 5 or higher (e.g. it will downgrade all iron mines to level 4 or lower if they're already below that). If you wanted none of that type of building level, then use 0 for both quantity and level: build i:0:0 would demolish all iron mines completely.
As of the 3096 public release, you are able to use conditions in goals. Conditions are checks to see if certain buildings or research targets are met first, and if so then to perform some building task. For example, if I wanted to demolish my last quarry and my workshop after I had upgraded walls to level 10, then I could write it as:
Looks confusing, but I promise it's not. The stuff inside the ??s is the condition. So we're checking above "if the walls are at least level 10 then demolish all the quarries and the workshop".
We can even go one step further and tell the bot to upgrade the walls to level 10 if they're not yet like so:
build ?w:10?q:0:0,ws:0:0 w:10
The above says if walls are at least level 10 then demolish all quarries and the workshop. It also says to build the walls to level 10 (just in case they're not).
You're able to mix in research conditions as well in the build goals, like so:
The above says if metal casting is at least level 10 and walls are at least level 10 then demolish all quarries and the workshop.
Now, just to throw in a bit of confusion for you... the ?condition?goal can be written in reverse too as goal?condition?. The following both mean the same thing:
build ?w:10?q:0:0,ws:0:0 build q:0:0,ws:0:0?w:10?
There is a neat trick you can use with these building conditions that may help you when writing your goals. You can use a 0 in the quantity spot for a building to tell the condition to trigger if you have no buildings of that level or higher.. for example:
The above says if I have no iron mines at level 4 or higher, then build 40 sawmills to level 9.
If you would like even more precise control over building order along with research order, check out the Plan goal.