Is there a way to order a group of units to move towards a point, and only if the way is blocked to start attacking. Doing triggers on a defence map with ground units, the path is just a straight single lane, but I can't get the units to attack if blocked by units. If I completely block of with buildings they will attack, but if I create a choke with buildings and block the choke with units, the enemy waves will simply run towards the choke and clog up there without attacking back. I haven't been able to find an action or order type that will do what I am looking for, but if there actually isn't is there any workaround to accomplish this? Preferably without the use of an insane number of small regions and check if they stay in one for a prolonged period of time.
I was considering doing a timer that hits every few seconds and randomly picks one of the units from the attacking wave, waiting a few seconds, and check if the unit is still in the same position (or in very near proximity to it). I don't consider it to be a very clean way to code however, and surely there must be a better and more reliable way for this?
Hmm.. I'm thinking you could make a new super fast unit and make it try and run through, if too much time passes you could assume that the way is blocked. The unit should not collide with ground, u could set it to collide with Unused (Land 2), and also set the player's units to collide with this.
I haven't tested it or anything, so I don't know if it will work propperly.
I haven't tested this but I noticed the following conditional statement:
Comparison - Unit Order is Valid
** EDIT **
this conditional doesn't work as I hoped. looking if there is something else that works nicely
** END OF EDIT **
can you use that to check if the move order is valid (I hope blizzard added this to check if the unit can move there if all routes are visible)
I'll see if I can figure out something but hope this will work ;)
Yeah I've tried that order is valid comparison and couldn't get it to work as hoped, I believe the problem is that it is actually a valid order, since enemy units can be moved around and thus don't block pathing apparently. The only times I've gotten the enemy to attack is when I pop like 5 waves at a time and there's just a retarded amount of units. I also tried setting the blocking units to pushable by the hostile waves, but even that is just a minimal effect with a properly clogged up choke. Really hate when I am stumbled like this :/
Value: Pathing Cost Between Points
Point 1: Center Of Region
Region: spawn
Point 2: Center Of Region
Region: blockade
The pathing cost is the time that it takes a unit to get to another point.
if it can't reach it then the amount will be 65536.
I've tested this on a small scale.
so if you use that statement in a comparison you can determine if there is a valid movement path between 2 points ;)
think this will solve it *prays*
ow you've got a unit choke... damn missed that reading *goes on testing this with units instead of buildings*
*EDIT*
doesn't work when there's a unit blockade :(
*END OF EDIT*
something worth looking at.....
you can check if a unit has stopped moving (even though the move order is still active) by checking it's position from time to time:
-------------
Untitled Trigger 002
Events
Timer - Every 2.0 seconds of Game Time
Local Variables
Conditions
Actions
Unit Group - Pick each unit in unitgroup and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(X of (Position of (Picked unit))) == (Custom value 0 of (Picked unit))
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Y of (Position of (Picked unit))) == (Custom value 1 of (Picked unit))
Then
Unit - Set (Picked unit) custom value 2 to ((Custom value 2 of (Picked unit)) + 1.0)
Text Tag - Create a text tag with the text (Combine ((Text(((Integer((Custom value 2 of (Triggering unit)))) * 2))))) for (All players), using a font size of 24, at (Position of (Picked unit)) and height offset 1.0 (initially Visible) can also set whether false is enforced
Else
Unit - Set (Picked unit) custom value 2 to 0.0
Else
Unit - Set (Picked unit) custom value 2 to 0.0
Debug - Display (Combine ((Text((Custom value 0 of (Picked unit))) with Any Precision decimal places), " - ", (Text((Custom value 1 of (Picked unit))) with Any Precision decimal places), " <-- positie.... .... duratie --> ", (Text((Custom value 2 of (Picked unit))) with as debug output using Type 2, and Do display it in the game window
Unit - Set (Picked unit) custom value 0 to (X of (Position of (Picked unit)))
Unit - Set (Picked unit) custom value 1 to (Y of (Position of (Picked unit)))
----------------
dunno how well this will assist you.
it's an annoying problem to say the least :S
I have a related problem.. I have waves of units that I want to Attack-Move to a position at the center of the map. The players are able to build structures and mass units, and I want the attacking waves to be able to attack everything on their way to the center. The problem though is that if a player blocks off the path completely, the attacking waves will no longer consider that blocked path as possible and will thus try to simply get as close as they can to where I told them to and then stopping, instead of going to the block and attacking their way through.
I guess I want the attackers to consider buildings as walkable (they can walk through them), but at the same time I don't want them to ACTUALLY walk through the buildings. Is that possible?
Edit: As for your problem.. wouldn't "Points Connected By Pathing" work perfectly? "Returns true if the specified points are connected by ground pathing." That sounds like it will return false if the path is blocked, in which case you can then order your units to attack.
Edit edit: My problem is solved. I backed up and looked at the problem on a simpler scale: The attacking waves would stop in their tracks and cease to be a threat. So, I made a trigger that runs when any unit becomes idle, checks to see if the owner is the attacking wave CPU and that the AI Pathing Cost is equal to -1 (Not 65535 like said above; it will be -1 if there is no path found.) Then I ordered the idle unit to attack-move to a random structure owned by any player. This way, if the players block and the attackers get stuck and stop moving, they will acquire a new target and head for one of the player's buildings, instead of the goal in the center of the map, thus breaking the blockade for future units.
Hey
Is there a way to order a group of units to move towards a point, and only if the way is blocked to start attacking. Doing triggers on a defence map with ground units, the path is just a straight single lane, but I can't get the units to attack if blocked by units. If I completely block of with buildings they will attack, but if I create a choke with buildings and block the choke with units, the enemy waves will simply run towards the choke and clog up there without attacking back. I haven't been able to find an action or order type that will do what I am looking for, but if there actually isn't is there any workaround to accomplish this? Preferably without the use of an insane number of small regions and check if they stay in one for a prolonged period of time.
I was considering doing a timer that hits every few seconds and randomly picks one of the units from the attacking wave, waiting a few seconds, and check if the unit is still in the same position (or in very near proximity to it). I don't consider it to be a very clean way to code however, and surely there must be a better and more reliable way for this?
Hmm.. I'm thinking you could make a new super fast unit and make it try and run through, if too much time passes you could assume that the way is blocked. The unit should not collide with ground, u could set it to collide with Unused (Land 2), and also set the player's units to collide with this.
I haven't tested it or anything, so I don't know if it will work propperly.
I haven't tested this but I noticed the following conditional statement:
Comparison - Unit Order is Valid
** EDIT **
this conditional doesn't work as I hoped. looking if there is something else that works nicely
** END OF EDIT **
can you use that to check if the move order is valid (I hope blizzard added this to check if the unit can move there if all routes are visible)
I'll see if I can figure out something but hope this will work ;)
Best Regards,
Helral
Yeah I've tried that order is valid comparison and couldn't get it to work as hoped, I believe the problem is that it is actually a valid order, since enemy units can be moved around and thus don't block pathing apparently. The only times I've gotten the enemy to attack is when I pop like 5 waves at a time and there's just a retarded amount of units. I also tried setting the blocking units to pushable by the hostile waves, but even that is just a minimal effect with a properly clogged up choke. Really hate when I am stumbled like this :/
think I found something....
worth testing on larger scale anyway:
Value: Pathing Cost Between Points
Point 1: Center Of Region
Region: spawn
Point 2: Center Of Region
Region: blockade
The pathing cost is the time that it takes a unit to get to another point.
if it can't reach it then the amount will be 65536.
I've tested this on a small scale.
so if you use that statement in a comparison you can determine if there is a valid movement path between 2 points ;)
think this will solve it *prays*
ow you've got a unit choke... damn missed that reading *goes on testing this with units instead of buildings*
*EDIT*
doesn't work when there's a unit blockade :(
*END OF EDIT*
something worth looking at.....
you can check if a unit has stopped moving (even though the move order is still active) by checking it's position from time to time:
-------------
Untitled Trigger 002
Events
Timer - Every 2.0 seconds of Game Time
Local Variables
Conditions
Actions
Unit Group - Pick each unit in unitgroup and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(X of (Position of (Picked unit))) == (Custom value 0 of (Picked unit))
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Y of (Position of (Picked unit))) == (Custom value 1 of (Picked unit))
Then
Unit - Set (Picked unit) custom value 2 to ((Custom value 2 of (Picked unit)) + 1.0)
Text Tag - Create a text tag with the text (Combine ((Text(((Integer((Custom value 2 of (Triggering unit)))) * 2))))) for (All players), using a font size of 24, at (Position of (Picked unit)) and height offset 1.0 (initially Visible) can also set whether false is enforced
Else
Unit - Set (Picked unit) custom value 2 to 0.0
Else
Unit - Set (Picked unit) custom value 2 to 0.0
Debug - Display (Combine ((Text((Custom value 0 of (Picked unit))) with Any Precision decimal places), " - ", (Text((Custom value 1 of (Picked unit))) with Any Precision decimal places), " <-- positie.... .... duratie --> ", (Text((Custom value 2 of (Picked unit))) with as debug output using Type 2, and Do display it in the game window
Unit - Set (Picked unit) custom value 0 to (X of (Position of (Picked unit)))
Unit - Set (Picked unit) custom value 1 to (Y of (Position of (Picked unit)))
----------------
dunno how well this will assist you.
it's an annoying problem to say the least :S
I have a related problem.. I have waves of units that I want to Attack-Move to a position at the center of the map. The players are able to build structures and mass units, and I want the attacking waves to be able to attack everything on their way to the center. The problem though is that if a player blocks off the path completely, the attacking waves will no longer consider that blocked path as possible and will thus try to simply get as close as they can to where I told them to and then stopping, instead of going to the block and attacking their way through.
I guess I want the attackers to consider buildings as walkable (they can walk through them), but at the same time I don't want them to ACTUALLY walk through the buildings. Is that possible?
Edit: As for your problem.. wouldn't "Points Connected By Pathing" work perfectly? "Returns true if the specified points are connected by ground pathing." That sounds like it will return false if the path is blocked, in which case you can then order your units to attack.
Edit edit: My problem is solved. I backed up and looked at the problem on a simpler scale: The attacking waves would stop in their tracks and cease to be a threat. So, I made a trigger that runs when any unit becomes idle, checks to see if the owner is the attacking wave CPU and that the AI Pathing Cost is equal to -1 (Not 65535 like said above; it will be -1 if there is no path found.) Then I ordered the idle unit to attack-move to a random structure owned by any player. This way, if the players block and the attackers get stuck and stop moving, they will acquire a new target and head for one of the player's buildings, instead of the goal in the center of the map, thus breaking the blockade for future units.