I've been trying to get an AI-controlled hero to farm creeps within a contained region for a while. Here is my latest failed attempt and I don't see why the trigger is broken.
Overview: to start with, a different trigger makes the hero, "Black Arrow", attack-move to the position of a random creep within the region "Central Creeps." The above trigger is then (theoretically) fired when the first creep in Central Creeps is killed by the hero. At that point, one of two things is meant to happen...
1
If the number of creeps within a set range of Black Arrow is 0, i.e. BA has finished killing off an entire group of creeps
AND
If Central_Creeps (a previously defined integer variable that I know to be working) is greater than 0, i.e. there are more creeps left to kill in the region
--don't worry about the other conditions--
THEN
BA will attack-move to another creep in the region, and hopefully will keep doing so, bouncing from one cluster of creeps to the next.
2, The alternative
If the number of creeps within a set range of Black Arrow is 0, i.e. BA has finished killing off a group of creeps
AND
If Central_Creeps = 0, i.e. no creep groups are left to kill within the region
THEN
BA returns to base
What is happening when I test it is BA kills the first group of creeps she is sent to, then stands there like a lemon. The trigger is supposed to detect that there are no creeps in her range and make her move onto another random group. But it isn't.
My suspicion is that the broken part in the trigger is the "number of units within 500 of BA matching (matching unit owned by Neutral Hostile) = 0" bit. All the other components, variables etc. are being used in other correctly functioning triggers, so... Thoughts? Prayers?
-
Farming Central New Copy
-
Events
- Unit - A unit Dies
-
Conditions
- (Central Creeps <gen> contains (Triggering unit)) Equal to True
- (Owner of (Killing unit)) Equal to Player 4 (Purple)
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in (Units within 512.00 of (Position of |c007900f2Black Arrow|r 0291 <gen>) matching ((Owner of (Matching unit)) Equal to Neutral Hostile))) Equal to 0
- Central_Creeps Greater than 0
- BA_Farming Equal to True
- Life_Drain Equal to False
-
Then - Actions
- Unit - Order |c007900f2Black Arrow|r 0291 <gen> to Attack-Move To (Position of (Random unit from (Units in Central Creeps <gen> owned by Neutral Hostile)))
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in (Units within 512.00 of (Position of |c007900f2Black Arrow|r 0291 <gen>) matching ((Owner of (Matching unit)) Equal to Neutral Hostile))) Equal to 0
- Central_Creeps Equal to 0
- BA_Farming Equal to True
- Life_Drain Equal to False
-
Then - Actions
- Set BA_Farming = False
- Unit - Order |c007900f2Black Arrow|r 0291 <gen> to Move To (Center of Undead Spawn 1 <gen>)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Overview: to start with, a different trigger makes the hero, "Black Arrow", attack-move to the position of a random creep within the region "Central Creeps." The above trigger is then (theoretically) fired when the first creep in Central Creeps is killed by the hero. At that point, one of two things is meant to happen...
1
If the number of creeps within a set range of Black Arrow is 0, i.e. BA has finished killing off an entire group of creeps
AND
If Central_Creeps (a previously defined integer variable that I know to be working) is greater than 0, i.e. there are more creeps left to kill in the region
--don't worry about the other conditions--
THEN
BA will attack-move to another creep in the region, and hopefully will keep doing so, bouncing from one cluster of creeps to the next.
2, The alternative
If the number of creeps within a set range of Black Arrow is 0, i.e. BA has finished killing off a group of creeps
AND
If Central_Creeps = 0, i.e. no creep groups are left to kill within the region
THEN
BA returns to base
What is happening when I test it is BA kills the first group of creeps she is sent to, then stands there like a lemon. The trigger is supposed to detect that there are no creeps in her range and make her move onto another random group. But it isn't.
My suspicion is that the broken part in the trigger is the "number of units within 500 of BA matching (matching unit owned by Neutral Hostile) = 0" bit. All the other components, variables etc. are being used in other correctly functioning triggers, so... Thoughts? Prayers?