• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] AI builds additional lower upgrade level buildings after they have been upgraded

Status
Not open for further replies.
Level 15
Joined
Sep 6, 2015
Messages
576
So, in my map there are Small and Large Construction sites which can be upgraded to various buildings.

The AI is set to do this in its building queue:
- Build one Small/Large Construction Site
- Build (upgrade) X (the building which is the upgrade of the Small/Large Construction Site)

But in-game it does this:
- Builds one Small/Large Construction Site
- Builds (upgrade) X (the building which is the upgrade of the Small/Large Construction Site)
- Builds one Small/Large Construction Site

So it seems that it must rebuild the lower upgrade level building after it has been upgraded to another building. It did this even with other buildings with upgrades, for example towers which can be upgraded from the Construction Sites and upgraded further to stronger towers. For the towers the AI went full retard and was stuck in a never-ending loop of building infinite number of them.

I've tried setting some building conditions in the AI editor, so that it doesn't build the Small/Large Construction Site after the building for which it is needed is constructed or becomes under construction, or removing the Construction Sites from the building queue completely, but nothing works. It just continues spamming a Construction Site for each building that is built (upgraded) from it, or doesn't build anything at all.
 
Level 15
Joined
Sep 6, 2015
Messages
576
It's not such a big or game-breaking problem for me to disable the AI, and limiting the number of buildings for the AI-controlled players will make them stop building, as they will be stuck in the building queue, since they still must build more of those and will rebuild those buildings, which wouldn't be available for them then. I need to find a way for the AI to stop building those additional lower upgrade level buildings in the first place.
 
Level 15
Joined
Sep 6, 2015
Messages
576
you can try with conditions,
build construction site only if there are buildings it will upgrade to in the BO
What AI editor condition command is used for that?

I tried setting "Unit - Total Units of Type" (the type of building the Construction Site is upgraded to), for example, to Less than 1, when that Construction Site was used for constructing the first building of a certain type, so that AI doesn't build the additional Construction Site when it is upgraded, but it won't work, it just keeps building it.
 
Level 15
Joined
Sep 6, 2015
Messages
576
I've found a solution for this. You've got to create an AI condition for each of the lower upgrade level buildings and add it to them in the building queue. The condition should contain "Number of (Lower Upgrade Level Building) Equal to 0 and Number of (Higher Upgrade Level Building (the building it upgrades to)) Equal to (the number of already-finished or started buildings of that type that come before in the building queue)". After you've done this, the AI won't build the extra lower upgrade level buildings after they have been upgraded or started upgrading to the higher upgrade level building.

Solved.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Dependency equivalents should be the solution. The AI needs to know that the upgraded buildings count as a construction site, similar to how a keep counts as a town hall. Hence the upgraded building should count as both the upgraded building and a construction site. Not sure how well WC3 supports this.

In SC2 they added enough intelligence to the AI that it will even build the construction site and upgrade it automatically when requesting the upgrade building. They also do something similar with technologies, where they will build the researching building automatically when requested to research a technology.
 
Level 15
Joined
Sep 6, 2015
Messages
576
Dependency equivalents should be the solution. The AI needs to know that the upgraded buildings count as a construction site, similar to how a keep counts as a town hall. Hence the upgraded building should count as both the upgraded building and a construction site. Not sure how well WC3 supports this.
For as far as I could see the Dependency Equivalents in the Object Editor don't work for buildings, and even the buildings of the melee races which are upgraded aren't added there (like the human towers), only the units which are morphing. I didn't check the Dependency Equivalents in Gameplay Constants, because there are only dependency equivalents for Town Halls, and not for normal buildings, and even the human towers aren't added there either. So I don't know how it should work, or if it works at all, or how Blizzard had done it with the human towers. It must have been hard-coded into the melee AI somehow, like with this condition that I've come up with.
 
Status
Not open for further replies.
Top