How do I make the AI know it can train special units with scripting?

I have successfully using triggers to let the barrack train samurai and archer range train longbows.

The issue is that I do so for the ai player as well but it does not know to train them,
it’s an especially serious issue when I replace the archer line with longbows.

even though I stated that:

(defconst unit7 8)

(defrule (goal activate yes) (unit-type-count-total unit7 < 40) (can-train unit7)
=> (train unit7)

it just doesn’t work.

Same with samurais in barrack.

is there some command like “train this from there” that I can use?

the per file

What about using triggers? Set area to all the map or where their base is, condition have X resources in stock and a timer… effect: train unit from building y and remove X resource as a cost.

Thanks for the reply, but I wanted to do it with script and I think I find the issue:

You basically HAVE TO use “change train location” instead of “add train location”.

1 Like

Maybe you can post this as a bug

“Add train location doesn’t work for the AI”

Okay, where do I write a bug report?

Here

And also, the bug report format

1 Like