How to modify the way the AI uses existing unit types with a new unit

Jiska

Warlord
Joined
Apr 23, 2016
Messages
164
Hello everyone,

I want to add a new unit, let's say a farmer unit, that replaces the worker for creating farm improvements. So I remove the 'build farm' button from the worker, and make a new unit, that like a great person is expended for a single improvement and then consumed, and give it a a 'build farm' button.

I'm pretty sure all this is feasible, but how do I get the AI to use my new unit properly, and do I have to modify the DLL for any of this?

Thanks.
 
The problem is not in getting the AI to use the Farmer (so long as its default unit AI type is UNITAI_WORKER) but in getting the AI to build them in the first place. If the AI decides it needs to improve land tiles, it'll build workers until it thinks it has enough. These workers (in your scenario) will then improve tiles. Given that they can't build farms, they will probably spam trading posts and possibly forts.

You will need to take manual control of the AIs' city production queues and push Farmer build orders onto some of them when your logic calculates that the AI needs a Farmer
 
Back
Top Bottom