I'm designing a custom AI to work in melee on a official blizzard map. Most of the AI and Advanced AI triggers make no sense to me.
So, what I've done is setup the build order all threw triggers and timings. My question is how do you make it so the comp will use abilities if they are researched?
For example, when my first attack wave from the comp set's out, they have stims, but when they get into a fight, they don't use the stims. How do I make the AI use the STIM packs? The campaign AI is enabled btw, so depots lower/raise, auto harvest, etc. Also, what is weird is the comp doesn't defend itself.
I know I can make a trigger that states if attack wave (unit grp) is attacked use ability stims. I would rather not have to do this and some how program it into the AI to use the abilities on it's own.
Use Stims
Events
Unit - Any Unit is attacked
Local Variables
Conditions
Use Abilities[1] == false
(Owner of (Triggering unit)) == 2
Or
Conditions
(Unit type of (Triggering unit)) == Marine
(Unit type of (Triggering unit)) == Marauder
Actions
Variable - Set Use Abilities[1] = true
Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 14.0)) owned by player 1 matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit Group - Add (Picked unit) to Player's Army
General - If (Conditions) then do (Actions) else do (Actions)
If
(Number of Living units in Player's Army) >= ((Number of Living units in Attack Wave[1]) / 2)
Then
Unit - Order all units in Attack Wave[1] to (Marine - Use Stimpack) (Replace Existing Orders)
General - Wait 10.0 Game Time seconds
Variable - Set Use Abilities[1] = false
Else
This trigger works flawlessly with the exception of one major problem.... The marines/marauders use the stim pack twice........ WHY? Help plz!!
I also tested out the stim ability on a unit just standing still and it looks like even if I tell a single unit to use stim's, he uses it twice.... I don't understand this.
Update:
It's the ability command... If I manually click on stims on one of my marines it only takes off 10 life. If I issue an order for my marine to use stims, it takes off 20 life... BUG?
Final Update:
Ok... For whatever reason. Going into the data editor and changing the amount of life cost then resetting it back fixed it........
Still need to know:
How do you make it so the comp will use abilities if they are researched? Like program the AI to use abilities not with a trigger like the one above.
I've been afraid to play with the AI triggers, I honestly couldn't even tell you what an attack wave is considered.
But as for your double stimming problem, if you wanted to avoid using the data editor, to ruin Human T vs Comp T, you can add an additional line to your trigger, to give the units that just stimmed an additional 10 health. For example:
It isn't foolproof, the units that used stim bellow 30 health, but above 20 would unfairly NOT get their wasted health back, but it makes it so the units that didn't have enough health for stim don't get health back, and the ones above 30 health initially get health back.
Ya dude the AI triggers are CONFUSING as hell. I'm playing around with them and learning a lot. It's weird how that got fixed. The only other problem I see now, is the units have a fall back point it looks like. Like if they are attacked, and you kite them, after moving a certain range they return to their original position.
In wc3 you could disable this. In here, I have no idea where. Do you know?
Won't this make it for ALL units like that? I'm designing a melee match vs ai. What if it's terran vs terran? Won't the unit data be the same?
I'm not sure what you mean. The Tactical AI is used for units to make their own tactical decisions about when to use abilities and who to target with them, while the trigger AI is used for strategic decisions like sending attack waves.
If you're worried about it mucking with the human controlled units, tactical AI is only enabled when the unit is computer controlled.
1st timing attack made by comp opponent. Comp has about 8 marines and 6 marauders with all tech lab upgrades and lv 1 weapons finishing by the time he hits you
Setting up your attack wave:
First Attack Wave
Events
Timer - Attack Timer[1] expires
Local Variables
Conditions
Actions
Unit Group - Pick each unit in Infantry[1] and do (Actions)
Actions
Unit Group - Add (Picked unit) to Attack Wave
Unit Group - Remove all units in Attack Wave from Infantry[1]
AI - Add Attack Wave to the next attack wave for player 2
AI - Enable suicide for Attack Wave
AI - Add an attack wave waypoint at Players Expansion for player 2 using Normal Mode
AI - Add an attack wave waypoint at Players Ramp for player 2 using Normal Mode
AI - Add an attack wave waypoint at Players Base for player 2 using Normal Mode
UI - Display "First Attack Wave Setting Out" for (All players) to Subtitle area
AI - Send the attack wave from player 2 to attack in 10 seconds and Wait
Trigger - Turn Move Attackers On
Comp Using Stim Packs:
Use Stims
Events
Unit - Any Unit is attacked
Local Variables
Conditions
Use Abilities[1] == false
(Owner of (Triggering unit)) == 2
Or
Conditions
(Unit type of (Triggering unit)) == Marine
(Unit type of (Triggering unit)) == Marauder
Actions
Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 14.0)) owned by player Any Player matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) == 1
Then
Unit Group - Add (Picked unit) to Player's Army
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Number of Living units in Player's Army) >= ((Number of Living units in Attack Wave) / 2)
((Picked unit) is in (Region((Center of Player's Army), 14.0))) == true
Then
Variable - Set Use Abilities[1] = true
Unit - Order (Picked unit) to (Marine - Use Stimpack) (Replace Existing Orders)
General - Wait 15.0 Game Time seconds
Variable - Set Use Abilities[1] = false
Else
This trig pretty much says if players army is half/equal to the size of the comp army, tell comp army units in that AREA to use stim packs, then wait for 15 seconds and re-enable the trigger
If army is IDLE:
Idle Army
Events
Unit - Any Unit Becomes idle
Local Variables
Conditions
(Owner of (Triggering unit)) == 2
((Triggering unit) is in Attack Wave) == true
Actions
AI - Add Attack Wave to the next attack wave for player 2
AI - Enable suicide for Attack Wave
AI - Send the attack wave from player 2 to attack in 0 seconds and Don't Wait
To disable the return rate/value where the army goes back to the starting location, you have to "enable suicide" for the attack wave. You can setup attack waypoints for the army to travel on, but without any, the AI automatically seeks out any opponent's unit, which is better I think. Also, you have to have "AI - Start the campaign AI for player 2" enabled before any of these triggers for this to work, I'm pretty sure, not 100% positive.
That is good to know. I will have to play around with that. Too bad the trigger system is already created lol
Is there any way to do like use stim packs if X amount of enemy units are present? Like how I have setup in the trigger system?
Also, do you know how to enable the units to defend their town without have a trigger like this:
Building Attacked
Events
Unit - Any Unit is attacked
Local Variables
Conditions
(Owner of (Triggering unit)) == 2
((Triggering unit) is Required: Structure for player 2) == true
Actions
Unit - Order all units in Infantry[1] to ( Attack targeting (Position of (Triggering unit))) (Replace Existing Orders)
ALSO, how do you set targeting priorities? Like how do you make it so the army will target siege tanks 1st over any other units?
I don't know. I've explored the tactical AI enough to have a rough idea of how the pieces fit together, but not enough to actually implement anything. If you want to get in there it'll be uncharted territory, since I have yet to see anyone post any guides on how it works.
I couldn't find anything in there, so I resorted to triggers for tactical AI decisions.
Here is what I came up with:
Use Abilities
Events
Unit - Any Unit is attacked
Local Variables
X = 0 <Integer>
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Use Abilities[1] == false
(Owner of (Triggering unit)) == 2
Or
Conditions
(Unit type of (Triggering unit)) == Marine
(Unit type of (Triggering unit)) == Marauder
Then
Region - Move Tanks to (Position of (Triggering unit))
General - Wait 0.01 Game Time seconds
Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 25.0)) owned by player Any Player matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) == 1
Then
Unit Group - Add (Picked unit) to Player's Army[0]
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) == 2
Then
Unit Group - Add (Picked unit) to Comp Units[0]
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Number of Living units in Player's Army[0]) >= ((Number of Living units in Comp Units[0]) / 2)
((Unit 1 from Player's Army[3]) is in Tanks) == true
Then
Variable - Set Use Abilities[1] = true
Unit - Order all units in Comp Units[0] to (Marine - Use Stimpack) (Replace Existing Orders)
General - Wait 15.0 Game Time seconds
Variable - Set Use Abilities[1] = false
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Use Abilities[2] == false
(Owner of (Triggering unit)) == 2
Or
Conditions
((Triggering unit) is in Infantry[1]) == true
((Triggering unit) is in Attack Wave[1]) == true
((Triggering unit) is in Attack Wave[2]) == true
((Triggering unit) is in Attack Wave[3]) == true
((Triggering unit) is in Attack Wave[4]) == true
((Triggering unit) is in Attack Wave[5]) == true
((Triggering unit) is in Attack Wave[6]) == true
((Triggering unit) is in Attack Wave[7]) == true
((Triggering unit) is in Attack Wave[8]) == true
((Triggering unit) is in Attack Wave[9]) == true
((Triggering unit) is in Attack Wave[10]) == true
Then
Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 25.0)) owned by player 1 matching Required: Cloaked, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
And
Conditions
(Unit type of (Picked unit)) == Banshee
(Banshee - Cloaking Field is Enabled for (Picked unit)) == true
And
Conditions
(Unit type of (Picked unit)) == Ghost
(Ghost - Personal Cloaking is Enabled for (Picked unit)) == true
Then
Unit Group - Add (Picked unit) to Player's Army[1]
Variable - Set Use Abilities[2] = true
Unit - Order Command Building[1] to (Orbital Command - Scanner Sweep targeting (Center of Player's Army[1])) (Replace Existing Orders)
Unit - Order (Picked unit) to ( Attack units in Player's Army[1]) (Replace Existing Orders)
General - Wait 15.0 Game Time seconds
Variable - Set Use Abilities[2] = false
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == 2
Or
Conditions
((Triggering unit) is in Infantry[1]) == true
((Triggering unit) is in Attack Wave[1]) == true
((Triggering unit) is in Attack Wave[2]) == true
((Triggering unit) is in Attack Wave[3]) == true
((Triggering unit) is in Attack Wave[4]) == true
((Triggering unit) is in Attack Wave[5]) == true
((Triggering unit) is in Attack Wave[6]) == true
((Triggering unit) is in Attack Wave[7]) == true
((Triggering unit) is in Attack Wave[8]) == true
((Triggering unit) is in Attack Wave[9]) == true
((Triggering unit) is in Attack Wave[10]) == true
Then
Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 18.0)) owned by player 1 matching Required: Mechanical, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Unit type of (Picked unit)) == Siege Tank (Siege Mode)
(Unit type of (Picked unit)) == Siege Tank (Tank Mode)
Then
Unit Group - Add (Picked unit) to Player's Army[3]
General - For each integer X from 1 to 10 with increment 1, do (Actions)
Actions
Unit - Order all units in Attack Wave[X] to ( Attack units in Player's Army[3]) (Replace Existing Orders)
Else
Else
This works amazingly well :D
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm designing a custom AI to work in melee on a official blizzard map. Most of the AI and Advanced AI triggers make no sense to me.
So, what I've done is setup the build order all threw triggers and timings. My question is how do you make it so the comp will use abilities if they are researched?
For example, when my first attack wave from the comp set's out, they have stims, but when they get into a fight, they don't use the stims. How do I make the AI use the STIM packs? The campaign AI is enabled btw, so depots lower/raise, auto harvest, etc. Also, what is weird is the comp doesn't defend itself.
I know I can make a trigger that states if attack wave (unit grp) is attacked use ability stims. I would rather not have to do this and some how program it into the AI to use the abilities on it's own.
Does anyone know how to do this?
Open up the Data Editor and look through Tactical AI, Target Find, and Validators - especially those starting with "Tactical".
Won't this make it for ALL units like that? I'm designing a melee match vs ai. What if it's terran vs terran? Won't the unit data be the same?
Ok, so I came up with a trigger, it says:
This trigger works flawlessly with the exception of one major problem.... The marines/marauders use the stim pack twice........ WHY? Help plz!!
I also tested out the stim ability on a unit just standing still and it looks like even if I tell a single unit to use stim's, he uses it twice.... I don't understand this.
Update: It's the ability command... If I manually click on stims on one of my marines it only takes off 10 life. If I issue an order for my marine to use stims, it takes off 20 life... BUG?
Final Update: Ok... For whatever reason. Going into the data editor and changing the amount of life cost then resetting it back fixed it........
Still need to know:
How do you make it so the comp will use abilities if they are researched? Like program the AI to use abilities not with a trigger like the one above.
I've been afraid to play with the AI triggers, I honestly couldn't even tell you what an attack wave is considered.
But as for your double stimming problem, if you wanted to avoid using the data editor, to ruin Human T vs Comp T, you can add an additional line to your trigger, to give the units that just stimmed an additional 10 health. For example:
It isn't foolproof, the units that used stim bellow 30 health, but above 20 would unfairly NOT get their wasted health back, but it makes it so the units that didn't have enough health for stim don't get health back, and the ones above 30 health initially get health back.
Ya dude the AI triggers are CONFUSING as hell. I'm playing around with them and learning a lot. It's weird how that got fixed. The only other problem I see now, is the units have a fall back point it looks like. Like if they are attacked, and you kite them, after moving a certain range they return to their original position.
In wc3 you could disable this. In here, I have no idea where. Do you know?
I'm not sure what you mean. The Tactical AI is used for units to make their own tactical decisions about when to use abilities and who to target with them, while the trigger AI is used for strategic decisions like sending attack waves.
If you're worried about it mucking with the human controlled units, tactical AI is only enabled when the unit is computer controlled.
Ha, ok got everything working flawlessly!
Ok so check this out:
1st timing attack made by comp opponent. Comp has about 8 marines and 6 marauders with all tech lab upgrades and lv 1 weapons finishing by the time he hits you
Setting up your attack wave:
Comp Using Stim Packs:
This trig pretty much says if players army is half/equal to the size of the comp army, tell comp army units in that AREA to use stim packs, then wait for 15 seconds and re-enable the trigger
If army is IDLE:
To disable the return rate/value where the army goes back to the starting location, you have to "enable suicide" for the attack wave. You can setup attack waypoints for the army to travel on, but without any, the AI automatically seeks out any opponent's unit, which is better I think. Also, you have to have "AI - Start the campaign AI for player 2" enabled before any of these triggers for this to work, I'm pretty sure, not 100% positive.
@RileyStarcraft: Go
That is good to know. I will have to play around with that. Too bad the trigger system is already created lol
Is there any way to do like use stim packs if X amount of enemy units are present? Like how I have setup in the trigger system?
Also, do you know how to enable the units to defend their town without have a trigger like this:
ALSO, how do you set targeting priorities? Like how do you make it so the army will target siege tanks 1st over any other units?
I don't know. I've explored the tactical AI enough to have a rough idea of how the pieces fit together, but not enough to actually implement anything. If you want to get in there it'll be uncharted territory, since I have yet to see anyone post any guides on how it works.
I couldn't find anything in there, so I resorted to triggers for tactical AI decisions.
Here is what I came up with:
This works amazingly well :D