AI won't build unique improvement

MoeTheCamel

Chieftain
Joined
Sep 28, 2017
Messages
11
In my mod I have a unique improvement which is never built by the AI. I know that the AI decides what to do based on flavors assigned to buildings, units etc but I looked through some of the XML files of the base game and it seems like you can't assign flavors to builds (improvements did have flavors but as far as I can tell they are never used in game so I'm assuming they don't work either). Is there any way of making the AI decide to build a modded unique improvement?
 
IIRC the AI only uses yield gain when deciding which improvement to add to a tile - this is why it spams trading posts during golden ages. So if your improvement doesn't give the best yield increase for tile it'll never build it, or if it doesn't give the best yield increase of the yield type most desired by the city (AI cities do specialise), it'll also never get built.

If you're using a modded dll, you can force the AI's hand with the improvement events (on the wrong machine to get details)
 
My improvement is built by workers, however it needs to be built over salt and is unlocked in the late game as an improvement to salt mines. This means that normally the worker would have to replace already built mines to build the new improvement, however I've been doing some testing and the workers build the improvement fine when there is no mine already there, which is good. I also turned off the option which prevents workers from building over improvements, but they still don't want to build over already existing mines (which have worse yields). If building over an existing improvement is something the AI never really wants to do, I might just make a lua script which deletes my unique civ's already existing salt mines if it's controlled by an AI upon researching the tech required - this way the workers should decide to build the unique improvements straight away and it'll be basically the same thing. I'm open to other suggestions though!
 
What if …
… the AI has no workers near?
... the workers are all engaged building roads/rail?
… the AIs city is dependant on the food bonus from the base improvements?
… the AI is dependant on the production boost (especially if at war)?
… the salt is part of a trade deal?

May be better to upgrade one salt mine every X turns controlled by the AI for a cost of Y gold
 
Back
Top Bottom