HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Best way to prevent units from attacking?

06-10-2008, 10:37 AM#1
Devion
Hey, im wondering which way is the most effective when I only want units to attack if a building is blocking their way.

Right now I have a checkpoint based movement system, when a unit reaches a checkpoint its custom value is changed (and its ofc ordered to continue moving). If a unit attacks anything its ordered to move to the next checkpoint based on the custom value.

However, Im not 100% sure this fixes the attacking problem completly. Sometimes units attack even if the way isnt blocked and I have no idea why.
And if the building really is blocking then maybe this system prevents the creeps from correctly destroying blocking buildings.

Any ideas or suggestions?
06-10-2008, 03:12 PM#2
Strilanc
Quote:
Originally Posted by Devion
Hey, im wondering which way is the most effective when I only want units to attack if a building is blocking their way.

Right now I have a checkpoint based movement system, when a unit reaches a checkpoint its custom value is changed (and its ofc ordered to continue moving). If a unit attacks anything its ordered to move to the next checkpoint based on the custom value.

However, Im not 100% sure this fixes the attacking problem completly. Sometimes units attack even if the way isnt blocked and I have no idea why.
And if the building really is blocking then maybe this system prevents the creeps from correctly destroying blocking buildings.

Any ideas or suggestions?

In power towers I teleport the units a short distance (then longer distances if they are blocked again), which does a good job getting them over intentional walls.

Detecting when they are walled is the hard part. I wrote a library that checks for units being stuck, backtracking, stopping and attacking. It seems to work pretty well.