• 🏆 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!

Controlling my AI

Status
Not open for further replies.
Level 9
Joined
Apr 22, 2020
Messages
430
Hello guys can anyone pls tell me how do i make a defensive AI? Meaning to say i want my AI to defend Thier and My base at the same time and also not to make them attack just stay in thier base and defend and also how do i limit the units my ai trains? Like i want my ai to train only four footman and if two or more of them dies replace them with the same units as it was but also limiting only to four footman.
 
Level 9
Joined
Apr 22, 2020
Messages
430
To make ai stay in their base use the Trigger AI - Ignore All Unit Guard Positions
To Limit the training use the Trigger Player - Limit Training of Unit-Type
That's the only thing I know.
Okay thanks anyways and do you also know how to make the ai build a specific unit like i want them to build four knights.
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
Okay thanks anyways and do you also know how to make the ai build a specific unit like i want them to build four knights.
You just add that unit x4 times in the building/training list of the AI in the AI editor.

Hello guys can anyone pls tell me how do i make a defensive AI? Meaning to say i want my AI to defend Thier and My base at the same time and also not to make them attack just stay in thier base and defend and also how do i limit the units my ai trains?
As for your first question, if you don't want the AI to attack, do not give it any attack groups. If you want it to defend the user, tick the box "Defend User" or something like that on the first page of the AI editor.

To make ai stay in their base use the Trigger AI - Ignore All Unit Guard Positions
From my understanding, that trigger action will make it so if they die, they will not go back to their original place. So, in map 02 RoC human campaign, there are some grunts and headhunters around a fire near your/Uther's base. If you kill them, then when the I rebuilds those units, they will not go back to the fire location. If you did not use that trigger, all pre-placed units go back to their original location.

To Limit the training use the Trigger Player - Limit Training of Unit-Type
That should only be used for real players. For a computer AI, just only add the number you want built in the AI editor and that itself already limits the number.

Like i want my ai to train only four footman and if two or more of them dies replace them with the same units as it was but also limiting only to four footman.
If you set the AI to build 4 footmen, it will replace them automatically, assuming you give it enough gold (/lumber).
 
Level 9
Joined
Apr 22, 2020
Messages
430
I have been confused whats the difference between Ai - Recycle Unit Guard Positions and AI - Lock Guard Position whats the difference?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
I was under the impression that Ignore Guard Position prevented units from returning to their "guard positions" after a fight/once they became idle. And the guard position was where they were originally created.

I know for a fact that it has this effect in a map I made where enemies are ordered to Attack Move to random points around the map. Without Ignore Guard Position, the enemies would run to the center of the map (where I originally created them) after a battle was over. With Ignore Guard Position, they would stand still after the battle until given further orders.

It may have other effects that I'm unaware of though.
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
I have been confused whats the difference between Ai - Recycle Unit Guard Positions and AI - Lock Guard Position whats the difference?
If you are just making a defensive AI (or any other AI), I think you can ignore those things. The only triggers you need for a normal AI is giving them periodic gold/lumber, + initiating the AI.
 
Level 9
Joined
Apr 22, 2020
Messages
430
So if i want this triggers to work do i have to make the AI in the AI editor and Import it and THEN use those triggers? Or i can just use them Directly?
 
Level 9
Joined
Apr 22, 2020
Messages
430
Which triggers are you referring to?

You need to make the AI in the AI editor, then export it then import it into the map, then use triggers to activate it.
(I'm referring to all of the triggers you guys just said) So i have to make an Ai first and then apply the Triggers that you guys just said.

Edit:Oh almost forgot to ask do you guys know what trigger is to rebuild the AI Building that has been destroyed? And what are the functions of the conditions tab ( The big white blank space)inside the AI editor?
 
Last edited:
Level 23
Joined
Jul 26, 2008
Messages
1,321
(I'm referring to all of the triggers you guys just said) So i have to make an Ai first and then apply the Triggers that you guys just said.
You make the AI in the AI editor, then export it, then import it into your import editor.
The only trigger you "need" is the one that activates the AI--start/initiate XX ai.
Of course, unless you want it to reply on the gold and lumber it collects, it is best to add in a gold/lumber trigger that adds resources periodically.

Edit:Oh almost forgot to ask do you guys know what trigger is to rebuild the AI Building that has been destroyed?
You dont need any triggers for this, the AI will do it itself as long as you have that building in the build list for the AI (which you make in the AI editor).

And what are the functions of the conditions tab ( The big white blank space)inside the AI editor?
Conditions can make the AI smarter. You can ignore them for now if you just want to build an AI.

I suggest you go look at how the AI in this campaign is made. Shadows of Hatred v1.4
It is a really good example of AI built in the AI editor.
 
Level 9
Joined
Apr 22, 2020
Messages
430
You make the AI in the AI editor, then export it, then import it into your import editor.
The only trigger you "need" is the one that activates the AI--start/initiate XX ai.
Of course, unless you want it to reply on the gold and lumber it collects, it is best to add in a gold/lumber trigger that adds resources periodically.


You dont need any triggers for this, the AI will do it itself as long as you have that building in the build list for the AI (which you make in the AI editor).


Conditions can make the AI smarter. You can ignore them for now if you just want to build an AI.

I suggest you go look at how the AI in this campaign is made. Shadows of Hatred v1.4
It is a really good example of AI built in the AI editor.
Okay thanks for the explanation and do i have to open that campaign in the Campaign editor? Because if i must then that will not be possible because i also tried opening it but it wont open and the world editor crashes unexpectedly i'm guessing that this campaign is protected or there just might be a problem with my WE if you can do me a favor can you look it up for me pls? If you have time of course i dont really want to bother but can you look it up for me if you have time thnks!
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
I cannot access wc3 now, so I cannot extract it for you. His campaign is not protected. Is it possible you are on an older version of Wc3? Opening the campaign itself should not cause any crash even if the individual maps are protected.

Alternatively, you can go and try to open other RTS campaigns, and access the AI in them.
 
Level 9
Joined
Apr 22, 2020
Messages
430
I cannot access wc3 now, so I cannot extract it for you. His campaign is not protected. Is it possible you are on an older version of Wc3? Opening the campaign itself should not cause any crash even if the individual maps are protected.

Alternatively, you can go and try to open other RTS campaigns, and access the AI in them.
Yes im using the older version of my warcraft 3 1.24.1, i intend to update my warcraft3 to the patch 1.30 but i have kind of a trouble updatating it just like the download percent and bar that whenever i try reinstalling it is always cap in 60% unexpectedly and by the way if i finish updating my wc3 do my maps,campaigns and custom maps i have created would still be saved after i have updated my warcraft3?
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
Above the first comment of each map, you can see the recommended version to use for that map. Here is an e.g from the link above.


upload_2020-5-31_20-23-53.png



Note:It is only a recommendation, so it is not always accurate. If he is using 1.28 to save it, 1.24 might not be able to open it.

What do you mean by still be saved? If you update wc3, but do not save your maps in the editor, they will be on the old version you saved them. If you update and then save the maps on the newer version, then those maps will be saved on the newer version.

Also, before updating, it is always good to make a copy of your maps, because some of the updates change the structure of Wc3, which can delete any maps you have in your Wc3 folder.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Above the first comment of each map, you can see the recommended version to use for that map. Here is an e.g from the link above.

Note:It is only a recommendation, so it is not always accurate. If he is using 1.28 to save it, 1.24 might not be able to open it.

What do you mean by still be saved? If you update wc3, but do not save your maps in the editor, they will be on the old version you saved them. If you update and then save the maps on the newer version, then those maps will be saved on the newer version.

Also, before updating, it is always good to make a copy of your maps, because some of the updates change the structure of Wc3, which can delete any maps you have in your Wc3 folder.
So does my WE also update if i update my WC3 or it will just stay the same?
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
If you actually update Wc3 through Bnet, then both Wc3 and the editor will be replaced with the newer version.

If you are just downloading the patch (pirating), then your old Wc3 and editor will stay the same, but you will have a 2nd Wc3 and editor (the updated one).
 
Level 9
Joined
Apr 22, 2020
Messages
430
If you actually update Wc3 through Bnet, then both Wc3 and the editor will be replaced with the newer version.

If you are just downloading the patch (pirating), then your old Wc3 and editor will stay the same, but you will have a 2nd Wc3 and editor (the updated one).
Ohhh.... I think just updating the patch might be enough for me and oh by the way what do i do when i already have set up some buildings in my map and do not put them on the build Priorities will they still repair and rebuild those buildings? And also i have already set up some farms but in the AI editor food row it is still 0/12 i dont want them to build farms to avoid cramping up the buildings and since i have already set them up and why am i doing it this way? As i already have said this is like a holdout mission or map i dont want them to build anymore buildings just repair them and rebuild them and also i want to make all of the starting units but in the AI the food is 0/12 but i have already set up some farms so i dont want them to build any do you know how to fix this? And do you guys also know how to make the AI use a custom hero i just made like i want my custom Hero AI to Respond if his base gets attacked and if he\she is killed the AI resummons the hero?(Dont worry this will be my last question for this thread)
 
Last edited:
Level 23
Joined
Jul 26, 2008
Messages
1,321
think just updating the patch might be enough for me and oh by the way what do i do when i already have set up some buildings in my map and do not put them on the build Priorities will they still repair and rebuild those buildings?
You must add everything to the build priority, if you place a building on the map already that is not on the building list, the AI will bug.

Basically, add everything you want in the AI to the build priority. Then you can choose: either place the building or unit you want on the map, or don't and let the AI build it. Of course, you need to place the main building of the race on the map so that it can create workers which then make the other buildings. But it is your choice if you want the other buildings pre-placed on map, or not (so AI builds them).

In my opinion it is best to pre-place buildings, so you have an initial layout for the AI base. It is also a good idea to preplace multiple units near the outside of your base where enemy's will attack, if that AI will fight other AI. This is because enemy AI often targets the nearest building/structure to their own base, and if you have 1 single building (like a tower) on the outside of your base, enemy AI will often attack it then retreat. This is why if you have multiple preplaced units there, it will keep the enemy AI busy long enough for your non-preplaced units to come, since non-preplaced units (ones that AI builds) will automatically stay around the goldmine/main building, unless it attacks of defends.

nd also i have already set up some farms but in the AI editor food row it is still 0/12 i dont want them to build farms to avoid cramping up the buildings and since i have already set them up and why am i doing it this way?
Even if you preplace on map, you need to include it in the build order.

If you dont like having too many farms, edit the food provided by a farm, so each one gives 50 food or something. But if you edit object data, then you will need to re-import the object data from your map, which will automatically delete the AI you have on the AI editor.

And do you guys also know how to make the AI use a custom hero i just made like i want my custom Hero AI to Respond if his base gets attacked and if he\she is killed the AI resummons the hero?
Custom AI hero must be preplaced on map, since the AI will be unable to "build it". It can only revive it, so the for the first time it must be on the map already (preplaced). But you still need to include it on the build order, even if it is preplaced. That way, the AI will automatically re-summon the hero. If you want it to defend the base, just place the hero near where the base will be attacked.

I strongly recommend you look at some of the AI in campaigns, or play around making your own, as it will help understand the AI editor better. Good luck.
 
Level 9
Joined
Apr 22, 2020
Messages
430
You must add everything to the build priority, if you place a building on the map already that is not on the building list, the AI will bug.

Basically, add everything you want in the AI to the build priority. Then you can choose: either place the building or unit you want on the map, or don't and let the AI build it. Of course, you need to place the main building of the race on the map so that it can create workers which then make the other buildings. But it is your choice if you want the other buildings pre-placed on map, or not (so AI builds them).

In my opinion it is best to pre-place buildings, so you have an initial layout for the AI base. It is also a good idea to preplace multiple units near the outside of your base where enemy's will attack, if that AI will fight other AI. This is because enemy AI often targets the nearest building/structure to their own base, and if you have 1 single building (like a tower) on the outside of your base, enemy AI will often attack it then retreat. This is why if you have multiple preplaced units there, it will keep the enemy AI busy long enough for your non-preplaced units to come, since non-preplaced units (ones that AI builds) will automatically stay around the goldmine/main building, unless it attacks of defends.


Even if you preplace on map, you need to include it in the build order.

If you dont like having too many farms, edit the food provided by a farm, so each one gives 50 food or something. But if you edit object data, then you will need to re-import the object data from your map, which will automatically delete the AI you have on the AI editor.


Custom AI hero must be preplaced on map, since the AI will be unable to "build it". It can only revive it, so the for the first time it must be on the map already (preplaced). But you still need to include it on the build order, even if it is preplaced. That way, the AI will automatically re-summon the hero. If you want it to defend the base, just place the hero near where the base will be attacked.

I strongly recommend you look at some of the AI in campaigns, or play around making your own, as it will help understand the AI editor better. Good luck.
Thanks for the reply i'm already trying to look at some ai's on some campaigns though i have a small problem when i imported the ai in my map and use the trigger Start melee ai the starting unit and building is a townhall and peasants the ai script i have imported are worgens and i'm basing them of the humans so how do i set the starting building and unit workers into worgens instead of the default humans? (If you have troubles understanding it - i have set custom units of worgens basing them of the humans and in the tool palette there is no start location button in the humans - custom where my worgens are so when i test the game the starting units are a human town hall and peasants but i want it to be the worgen hall and worgen workers do you knoe how to fix this?
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
You need to preplace at least the main building of the custom race and some workers.

I understand you mean, you modified the human race, instead of creating new custom units.

So how are you getting a townhall then? Assuming you changed the townhall to whatever custom main building you used for Worgen, just make sure to preplace that custom building + the worgen workers. You dont need a start location, just preplace the main building + workers near a goldmine and trees.
 
Level 9
Joined
Apr 22, 2020
Messages
430
You need to preplace at least the main building of the custom race and some workers.

I understand you mean, you modified the human race, instead of creating new custom units.

So how are you getting a townhall then? Assuming you changed the townhall to whatever custom main building you used for Worgen, just make sure to preplace that custom building + the worgen workers. You dont need a start location, just preplace the main building + workers near a goldmine and trees.
I have already perplaced them but i cannot test the map if player locations are not set so the human peasants and buildings are still gonna show up and if i set them to like player 12 they wont do anything since my map limits only 6 players and even if there are 12 players the map still needs the player starting location so how to fix this.
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
I cannot access Wc3, so I cannot help you, sorry. My only suggestion is to try to go to the alliance tab, and check "Custom alliance/custom settings", and run the AI trigger as "campaign Ai", not "melee AI".

Edit: If the above suggestion does not work, maybe I can look at the AI in 3-4 months when I am able to use Wc3. I remember having that same issue you describe when I first did AI, but I just cannot remember the correct method unless I am able to use Wc3. Anyway, if the above solution does not work, I will write another message here in 3-4 months, if you are still interested I can have a look myself.

If you are making a campaign, and the above solutions don't work, maybe just try ignoring the AI part for now, and do the other triggers/cinematics first.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Okay so where can i find this alliance tab?:grin::grin::grin:


Thats okay i'm not in a hurry anyway a 15 year old boy like me still have a lot to do in real life anyways, 3-4 months sounds a little long but as long as you can find a solution for my very complicated problem its worth the wait but do you think you can still find this thread after 3-4 months? Maybe you can just chat me in my profile so it would it be easy for me to find and Thank You so Much for your help even if this problem is not solved you still gave me tips on how and what to do in making an AI so Thank you very much and sorry i have bothered you.:grin:
 
Level 23
Joined
Jul 26, 2008
Messages
1,321
Its fine.

This is a picture from youtube, it is probably on an older version.



upload_2020-6-2_22-28-7.png




Make sure to check "use custom forces" and "fixed player settings", like in the picture above. They normally must be selected if you are using a custom race.

Also you might want to consider setting the "race" in the AI tab to custom race, instead of "human". That may also be the solution. I am not sure, since I have always made custom races as new units, instead of replacing the Hu/Or/NE/UD races. But first check to make sure "custom forces" and "fixed player settings" are checked.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Its fine.

This is a picture from youtube, it is probably on an older version.



Make sure to check "use custom forces" and "fixed player settings", like in the picture above. They normally must be selected if you are using a custom race.

Also you might want to consider setting the "race" in the AI tab to custom race, instead of "human". That may also be the solution. I am not sure, since I have always made custom races as new units, instead of replacing the Hu/Or/NE/UD races. But first check to make sure "custom forces" and "fixed player settings" are checked.
I have already did both of those things and still a fail.
 
Status
Not open for further replies.
Top