• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Custom AI trains unit beyond requested amount

Status
Not open for further replies.
Level 18
Joined
Oct 25, 2006
Messages
1,175
Hello there :)

upload_2020-11-26_18-5-43.png


I'm trying to setup a simple AI and so far as I understand, the AI should only train 4 Guards here.

Yet it trains an unlimited amount of Guards until it has no more supply available.

Any particular reason why it behaves like this?

Thanks in advance.
 
Level 14
Joined
Jun 15, 2016
Messages
753
You need to add a Farm or some food-production units before Builder (showed a red "1/0"). Current order is bug-out as Guard units are training before Builder, causing infinite loop until this Builder exists.
 
Level 18
Joined
Oct 25, 2006
Messages
1,175
Thanks for your answer!

upload_2020-12-17_22-14-39.png

I was setup like that before, but I tried again following your advice.

They have one peasant being automatically spawned, he builds a farm, a barracks and then all AI players spawns Guards until they are full supply.

If they get a new building providing food, they restart producing guards until they are stacked again.
 
Level 14
Joined
Jun 15, 2016
Messages
753
Try to put conditions to the last unit in build priorities, such gold and lumber amount/ or specific building/ or food cost (similar to 80% synergy in melee game), and see if that work.

Alternatively, I still suggest you to let at least one Builder train by natural method, not by spawn trigger.

Also always make sure that current total food limit trained is less than total food your buildings provided. (I guess the one you test is 6/5)

If none of these works, send me the demo map and I will see what can be fixed.
 
Last edited:
Level 18
Joined
Oct 25, 2006
Messages
1,175
Hello there, thanks for your help.

Try to put conditions to the last unit in build priorities, such gold and lumber amount/ or specific building/ or food cost (similar to 80% synergy in melee game), and see if that work.
Will try that out!

Alternatively, I still suggest you to let at least one Builder train by natural method, not by spawn trigger.
I previously tried the following order: Townhall -> Peasant -> Farm -> Barracks -> Footmen and was encountering the same behavior, but I will try again, I might have been something not properly setup.

Also always make sure that current total food limit trained is less than total food your buildings provided. (I guess the one you test is 6/5)
The AI players have more supply than needed, in fact they are training units up until they reach this cap.
EDIT: Oh yes, but now I understand. They have more, but it's not specified in this list. I will make sure to fix this!
EDIT2: In fact, I'm pretty convinced that the issue comes from here now that I had a bit time to think about it. I'm excited to try it out!

If none of these works, send me the demo map and I will see what can be fixed.
This is a quite generous offer and I'll make sure not to waste it if we come to that point!
 
Last edited:
Status
Not open for further replies.
Top