• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Footmen Wars Attacking AI

Status
Not open for further replies.
Level 2
Joined
Dec 20, 2012
Messages
9
Hey all, i created my own footmen wars map.

I start my map, the computer gets it's heroes, the units spawn and when i use greedisgood.
The computer upgrades and researches perfectly.

Everything looks well, but the computers are just standing there doing nothing.

I tried editing a bit with AI editor and entering triggers for the .AI to work.
It works but it's still not right. only computer BLUE sends only 1 unit in the beginning etc.

-------------------
THE QUESTION:

How can i make the computer select unit groups including their hero and attack a random enemy in the map?

All help is welcome, thanks!
 
Last edited:
Level 20
Joined
Jun 27, 2011
Messages
1,864
Like this? :p
  • AI
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in YourRegion <gen> owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of YourRegion2 <gen>)
 
Level 2
Joined
Dec 20, 2012
Messages
9
Like this? :p
  • AI
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in YourRegion <gen> owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of YourRegion2 <gen>)



It looks really good but. can you change it for me?
I'm kinda looking for (owned by computer) and actions (attack enemy)

Could you make it in such a way that they attack a random enemy and not a certain region?
 
Level 4
Joined
May 18, 2011
Messages
67


It looks really good but. can you change it for me?
I'm kinda looking for (owned by computer) and actions (attack enemy)

Could you make it in such a way that they attack a random enemy and not a certain region?

then disable the fog of the map, and max their combat acquisition range....
 
Level 2
Joined
Dec 20, 2012
Messages
9
Thanks UndeadImmortal, i'll give you a rep point for that information but.

Isn't there a way to do it with the AI editor?
Where the first 10 seconds nothing happen and then the computer assembles or selects all and attacks?

Because doing it like that makes it seem a little dumb if you ask me they just rush and don't use retreat.
I'm looking for smarter AI, anyone?
 
Last edited:
Level 2
Joined
Dec 20, 2012
Messages
9
Come on there has to be at least someone who knows a way how to get it done with AI Editor, i have a trigger that will make it work.

Events
Time - Elapsed game time is 1 sec.
If (All Conditions are True) then do (Then Actions)

ACTIONS
If - Conditions
(Player 1 (Red) controller) Equal to Computer

Then - Actions
AI - Start melee AI script for Player 1 (Red):war3mapImported\Player 1 RED.ai
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Could you make it in such a way that they attack a random enemy and not a certain region?
Isn't that pretty much the same thing in Footmen Wars?
If the region is centered on a player's base and you attack-move there, you're pretty much attacking a specific (yet random) enemy.

Come on there has to be at least someone who knows a way how to get it done with AI Editor, i have a trigger that will make it work.
You have way more freedom with triggers. The AI editor is actually pretty limited in custom maps.
 
Level 2
Joined
Dec 20, 2012
Messages
9
Then i meant footmen frenzy.
Look at the triggers of footmen Frenzy 9.1 AI.

There are no triggers telling troops to attack every so often.

It's beeing done by .ai

Go to Triggers > Begin Game > Center on Hero Taverns and AI Activation

You'll find it there
 

Attachments

  • Footmen Frenzy v9.1 AI.w3x
    761.1 KB · Views: 243
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Don't double-post.

Then i meant footmen frenzy.
Which is the exact same thing as Footmen Wars.

There are no triggers telling troops to attack every so often.

It's beeing done by .ai
I didn't say it was impossible or any of that. Also, there are triggers for everything except attacking.
I'm telling you: just using triggers will give you a lot more customization. It's also easier in the end.
 
Level 2
Joined
Dec 20, 2012
Messages
9
Don't double-post.


Which is the exact same thing as Footmen Wars.


I didn't say it was impossible or any of that. Also, there are triggers for everything except attacking.
I'm telling you: just using triggers will give you a lot more customization. It's also easier in the end.

No i know, sorry about that.
But i thought there had to be at least someone who knows how to work with the AI Editor since so many people use it for so long now.

I got pretty far though, the units fight, only the heroes are standing there.

If you don't mind, can you check out my map?
Maybe you can 'fix' my map it's attack problem, feel free to edit anything you want, let me know if you will.
 

Attachments

  • Footmen Frenzy Ultra AI v1.w3x
    171.6 KB · Views: 178
Level 28
Joined
Jan 26, 2007
Messages
4,789
Aren't those triggers exactly the same as the map you previously linked?
I mean, I don't really like it when people use other people's resources without credit (I even think it's deplorable).
From the looks of it, you're not even the actual author. You may have tweaked something here and there, but the way the entire map functions hasn't really been changed.

Anyway, there are so many things I like to change to that. The triggers are actually pretty bad (copying maps from EpicWar usually isn't a good idea :p).
I'm assuming the AI was left unchanged? (As you need to know some JASS for that).

i thought there had to be at least someone who knows how to work with the AI Editor since so many people use it for so long now.
Not many people use the AI editor. Once you learn how to trigger a little bit, then triggering will always be better than what you create with that little tool.
 
Level 2
Joined
Dec 20, 2012
Messages
9
Aren't those triggers exactly the same as the map you previously linked?
I mean, I don't really like it when people use other people's resources without credit (I even think it's deplorable).
From the looks of it, you're not even the actual author. You may have tweaked something here and there, but the way the entire map functions hasn't really been changed.

Anyway, there are so many things I like to change to that. The triggers are actually pretty bad (copying maps from EpicWar usually isn't a good idea :p).
I'm assuming the AI was left unchanged? (As you need to know some JASS for that).


Not many people use the AI editor. Once you learn how to trigger a little bit, then triggering will always be better than what you create with that little tool.

I didn't see anything wrong with it since it's all basically a copy off of a copy.
Yes i took the AI off of Footmen Frenzy 9.1 AI since it was the only option for me to get to know more about triggers, my main language isn't so i don't understand all the variables too much.
I don't really know how to use certain events first, or how split it, to get what i'm looking for with all the if/then/else etc.


I have tried many days and nights with alot of pauses or other hobbies on editing/creating levels, everytime i try something with triggers, i fail miserably. So yes all i did was tweak and try to find ways to make it work, although the game concept itself will be customized by myself, different heroes, skills, upgrades, items etc. What it is now is basically still a test till i could figure out how it all works.

I don't know anything about JASS nor what it means. I changed the AI back to normal (from the previous map)
before that i had created my own AI but even as of how it is right now, it's not good, and the ones i had made were worse.

You have any idea yet what you could change? And what do you think about the map itself? :clol:

Thanks for your time btw.
 
Level 2
Joined
Dec 7, 2012
Messages
16
AI Editor is to make MELEE AI, for custom maps, you must use triggers.

No, the AI created with the AI editor works fine on custom maps. Perhaps you meant that the AI editor cannot test AI on custom maps.

Triggers give you better control of what happens when but AI can be used if you prefer.

All you really need to do is have a new custom AI, with the correct heroes, then give it the build priorities in the order you want it to train units/build in. NB: if it has a priority it cannot complete (not enough food, need to upgrade townhall first), all priorities below that will not be carried out.

Then make sure the attack waves have the right attack groups which contain the units you want in that wave, set the minimum forces so that they can attack without a hero (if that's what you want) and set the initial delay so it takes a certain time before the first wave. Set the repeats waves to the number of waves you have, or say 2 to have it repeat the last 2 waves. Target priorities will tell you which order the AI will attack various targets in; for your purposes you can probably remove everything but Enemy - Any Town.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Pit this is not StarCraft II, all you would need to do then is add the units to an attack wave and dispatch.

In WC3 it is lsightly more tricky.

Let us start with a basic AI.
You need to keep track of how many footman an AI owns. Once they have enough to launch an attack (usually at troop limit worth at base) you send them and the hero attack move into the centre.
Once they arrive in the centre and there are no hostile forces there it attack moves to a random enemy base.
When its forces kill an enemy base it retreats all surviving troops back to base for a repeat wave.
If the hero's health drops below 33% (or lets say 500) it retreats the hero to base.

This AI shows no real intelligence and will suicide its troops. It might have to wait a long time for its troops to finally die after retreating a hero. It also does not factor any environmental features next to which players are alive and if there are still enemies in the centre.

An improved AI.
The AI has two active unit squads, a main army and a home guard.
All spawned unit are put into the home guard.
The hero is always in the main army.

The home guard has its own intelligence governing it. Its main use is to reinforce the main army with new troops but in a way that they cannot become victim to sniping. It also servers to delay attackers allowing time for the main army to come and save bases.
In the case of team wars maps the home guard will rush to the defense of neighbouring ally bases that are attacked via attack move (the ground not the base). If the main base of the AI is weak (so could easilly be snipped) then it will not help allied bases.
The home guard will always unload its troops to the main army every time it is in base. The home guard can also be called to reinforce the main army but only if the main army requests so.

The main army has the hero in it and does the attacking. When in base it loads from the home guard with troops. When between 50% and 70% full it will attack the centre. If the main base or alliend bases are attacked it retreats back to the main base. If the hero is going to die it retreats back to main base. Additionally if the army has suffered high troop loss (below 30%-20%) it retreats to be reinforced (home guard joins it) before attacking again. If centre combat is low it looks for a target to attack. If attacking a target and heavy hostile presence starts to build up the exit route it also starts to retreat.
When in centre it analyses who is the weakest target to attack, aiming at players who have just suffered heavy looses in middle or who have just repelled an attack. It might also look for enemy armies who are already attacking a player and weak and try and flank attack them before moving on to the player. On the opposite it avoids players with large hostile forces down their lane or who have hostile forces in centre between them.
The AI will call reinforcements from the home guard when attacking the centre and below 50% of troops. It will also call reinforcements when attacking a lane and there being no hostile activity in centre.
The AI can also suicide troops to retreat. Specificly ones that normal units are attacking at the edges of the army might be left to die when retreating to allow a clean retreat.

If the AI is on a team it would as a team sharing common main group states. If most of the team is forced into retreat then even players which are perfectly fine for combat will retreat as well. The target to attack is shared among all AI on the same team so that they will attack together. Attacks can start before all AI are ready (as long as most are).

This is a much more complex but much smarter AI that would mimic behaviour similar to some humans in wars maps. The only way to improve it would be to question and watch highly skilled players and make adjustments so it acts more like them.
 
Status
Not open for further replies.
Top