Before making a new topic:First, check if your question has already been answered in the Tutorials section.If you didn't find a solution, use the search function.If searching didn't help either, you can make a new topic.

Topic title & content:You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Spelling:Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.Read your posts twice, before pressing the reply button.And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

I have been trying to help a friend with a problem in his map, and after several unsuccessful attempts I felt I should ask you. The problem is where when a unit (the computer's hero in this case) is told to attack a player's hero, and there are towers in the way of the shortest route to the player's hero, instead of the computer's hero running to the towers and attacking them, he simply sees them as a wall and tries to find another way around. Do you think you would be able to fix this so the computer's hero just simply attacks the towers and then runs to the player's hero?

My idea was to have a trigger constantly check offsets in front of the computer's hero to detect whether there is a building closely in front of it or not, and if so, enable collision and force the hero to attack it, and if there is no building within a close range in front of him, it would disable collision, allowing the computer's hero to follow a hero even if there is a building in the way, and then of course, when that building is detected, collision would be re-added and the hero would be forced to attack it.

The above method, the way I made it anyways, seems to sometimes work, and other times not. It mainly works when the computer's hero is pretty close to you when it tries to attack you. Also, for some reason, I notice that sometimes when the collision for the computer's hero is off, it will let him walk through the buildings (like it should, so that it's able to click through it and walk to it), but other times it acts as if the building is a wall and doesn't bother to try walking through it.

Sorry if this seems extremely redundant, I'm just trying to give you a good overview of the situation and since it's 6 A.M., I'm far too tired to re-read and edit it right now.

Here is my friend's map that includes the solution I was working on, so you can look at that if you want to. I would recommend testing it on RoC, as the few times that I tried it on TFT the computer's hero didn't seem to want to even attack me, whereas on RoC it was normal.

Open any TD map that has the "creeps attack when blocked" concept implemented correctly.

Then steal the code! Treat the AI the same way the TD treated the creeps.

Done.

I'll now playtest the map:

Another idea that'd help with this situation: Limit the number of buildings each player can make. It's really easy to break the current AI by surrounding it with farms. (It goes Hold Position and lets me kill it with my peasant.) If each building had a limit of 2-3, it wouldn't be as easy to surround the Dreadlord.

I'll now look at the triggers:

Well, all I can see at first glance is that those unit groups leak...Otherwise it's a CPU intensive but otherwise solid AI.Not sure why it even breaks on TFT and not on RoC.

Edit: Spotted a bug!When doing Unit Group - Pick every unit in (Units within 128.00 of LeakPoint[1]), you shouldn't Unit - Order Unit[11] to Attack (Picked unit) because the attack orders override each other and the LAST unit in the group will be the only one attacked. Instead, you should break out of that loop as soon as you find the first building and attack that.Hmm... Isn't there a function for finding the Closest (mechanical) unit to an other unit? That'd be much better than going the unit groups route.

I gained more progress today with a few things I modified. It's now working whenever the computer's hero is within a close range (aka offset 128 in front of the hero and then anything within 128 of that offset point), due to the fact that collision has now been enabled and it has been forced to attack the building via the trigger. However, when collision is disabled, it's still unable to walk through the buildings, so instead of walking up to the building it continues to try to find a different path. Do you have any other ideas of what could make the hero able to walk through the buildings so he stops trying to walk around?