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!
Hey again, one more I return with a question! What I would like to know is how to make attack waves / spawn units to go and attack the enemy like in Mission 3: A Blaze of Glory. (The Orc's campaign in Frozen Throne.) Does anybody know how to do this?
there's just one problem: Occasionally some of the spawning units will go back to their spawning point and do absolutely nothing there. If waited long enough, they will began piling up and it's very annoying...
there's just one problem: Occasionally some of the spawning units will go back to their spawning point and do absolutely nothing there. If waited long enough, they will began piling up and it's very annoying...
An easy fix for that is to temporarily change ownership of the unit to a player that you are not using for 5 seconds, since that is the default guard time in Gameplay Constants.
An easy fix for that is to temporarily change ownership of the unit to a player that you are not using for 5 seconds, since that is the default guard time in Gameplay Constants.
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Unit - Create 1 Furbolg for Neutral Hostile at ((Center of (Playable map area)) offset by 1000.00 towards 0.00 degrees.) facing Default building facing degrees
Unit - Wake up (Last created unit)
-------- Change ownership of unit to an unused player --------
Unit - Change ownership of (Last created unit) to Player 2 (Blue) and Retain color
Trigger - Run Order <gen> (ignoring conditions)
Order
Events
Conditions
Actions
Unit - Order (Last created unit) to Attack-Move To (Center of (Playable map area))
-------- After 5 seconds, change the ownership of unit back to original --------
Wait 5.00 seconds
Unit - Change ownership of (Last created unit) to Neutral Hostile and Retain color
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Unit - Create 1 Furbolg for Neutral Hostile at ((Center of (Playable map area)) offset by 1000.00 towards 0.00 degrees.) facing Default building facing degrees
Unit - Wake up (Last created unit)
-------- Change ownership of unit to an unused player --------
Unit - Change ownership of (Last created unit) to Player 2 (Blue) and Retain color
Trigger - Run Order <gen> (ignoring conditions)
Order
Events
Conditions
Actions
Unit - Order (Last created unit) to Attack-Move To (Center of (Playable map area))
-------- After 5 seconds, change the ownership of unit back to original --------
Wait 5.00 seconds
Unit - Change ownership of (Last created unit) to Neutral Hostile and Retain color
It would be wise to use an AI Script rather than triggers because ordering units to attack move will result in units refusing to follow orders or returning to their spawn location as you already know.
Anyway, here's the AI that blizzard used in the last mission of the TFT orc campaign.
This represent the player which the AI has to attack. For example here 4 is Player (4) Purple
JASS:
call SuicideUnitB(FOOTMAN,user)
This tells the AI which unit it will send to attack. FOOTMAN is a constant that you can find inside Common.ai and 'h004' is a rawcode that you can find by pressing CTRL + D in the Object Editor.
Using an AI is ten times better because you don't have to worry about creating thousands of regions and ordering units to attack them using triggers. The AI will automatically find all the enemies on the map and attack them. You just need to edit the script above with a text editor and import it to your map.
It would be wise to use an AI Script rather than triggers because ordering units to attack move will result in units refusing to follow orders or returning to their spawn location as you already know.
Anyway, here's the AI that blizzard used in the last mission of the TFT orc campaign.
This represent the player which the AI has to attack. For example here 4 is Player (4) Purple
JASS:
call SuicideUnitB(FOOTMAN,user)
This tells the AI which unit it will send to attack. FOOTMAN is a constant that you can find inside Common.ai and 'h004' is a rawcode that you can find by pressing CTRL + D in the Object Editor.
Using an AI is ten times better because you don't have to worry about creating thousands of regions and ordering units to attack them using triggers. The AI will automatically find all the enemies on the map and attack them. You just need to edit the script above with a text editor and import it to your map.
You don't need experience in JASS to make an AI script, even I don't know much about JASS. You just have to remember what the functions do. The code I showed you is very simple, all you have to do is copy paste it in Notepad and change interger user 4 to the player you want to attack and add your units to the list. After that save the file as MyAIScript.ai and import it to your map then run it.
You don't need experience in JASS to make an AI script, even I don't know much about JASS. You just have to remember what the functions do. The code I showed you is very simple, all you have to do is copy paste it in Notepad and change interger user 4 to the player you want to attack and add your units to the list. After that save the file as MyAIScript.ai and import it to your map then run it.
How heavy is your base's defense compared to the rest of the map? I am guessing your enemies (preplaced units) are attracted to your base because it contains most of your units. That is the price of automation. In order to control the AI behavior, you will still have to code the specific parts.
For something as simple as preventing units from returning to spawn point, there is no need for AI scripts.
Simply setting the owner of the unit to an unused player will prevent this creep behavior. As I found out, you don't even need to change ownership.
Now if you wanted to keep the aggression of Neutral Hostile, then changing ownership will be necessary.
In the following test map, several creeps get spawned and are ordered to move. These creeps never return to spawn point.
How heavy is your base's defense compared to the rest of the map? I am guessing your enemies (preplaced units) are attracted to your base because it contains most of your units. That is the price of automation. In order to control the AI behavior, you will still have to code the specific parts.
For something as simple as preventing units from returning to spawn point, there is no need for AI scripts.
Simply setting the owner of the unit to an unused player will prevent this creep behavior. As I found out, you don't even need to change ownership.
Now if you wanted to keep the aggression of Neutral Hostile, then changing ownership will be necessary.
In the following test map, several creeps get spawned and are ordered to move. These creeps never return to spawn point.
The key point is the owner of the unit. Everything else is just superfluous. You just have to apply the key point to your own triggers and code.
PreventReturn
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
For each (Integer LoopInteger) from 1 to 10, do (Actions)
Loop - Actions
Unit - Create 1 Furbolg for Player 24 (Peanut) at ((Center of (Playable map area)) offset by 1000.00 towards 0.00 degrees.) facing Default building facing degrees
Unit - Wake up (Last created unit)
Trigger - Run Order <gen> (ignoring conditions)
Order
Events
Conditions
Actions
Unit - Order (Last created unit) to Attack-Move To (Center of (Playable map area))
Ah, you want the AI to attack your base not vice versa, I see. Well, that's how this AI is supposed to work. It picks all units on the map (including preplaced units) and order them to attack enemy structures, it doesn't however train them unless you tell the AI to do so. In the final mission of the orc bonus campaign units aren't trained but rather spawned using triggers. If you want to know how to train units I will gladly help.
By the way, there is no need to duplicate call SuicideUnitB(FOOTMAN, user) one is enough.
Ah, you want the AI to attack your base not vice versa, I see. Well, that's how this AI is supposed to work. It picks all units on the map (including preplaced units) and order them to attack enemy structures, it doesn't however train them unless you tell the AI to do so. In the final mission of the orc bonus campaign units aren't trained but rather spawned using triggers. If you want to know how to train units I will gladly help.
By the way, there is no need to duplicate call SuicideUnitB(FOOTMAN, user) one is enough.
I already used trigger "ai ignore guard trigger" to prevent unit return to base its working but the problem is Unit is stop walking and just stand there especially Mountain giant,Necromancer, druid of claw
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.