HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Prevent units from auto acquiring targets and attack

03-31-2010, 12:41 PM#1
Na_Dann_Ma_GoGo
Hi there,
I'm searching for a way to make prevent player controlled units to automatically acquire targets.
Just setting the acquisition range to 0.01 (zero doesn't work) won't do, as your units still attack when they or an allied unit is attacked by an enemy.

I want the units to attack only when you order them to. Kinda like workers do it.
However classifying the units as worker will create a worker icon on the bottom-left corner ingame which is a no-go.

So are there any ways to achieve this by certain object stats, abilities, advanced game settings or triggers?
03-31-2010, 12:57 PM#2
Tot
maybe with
EVENT_UNIT_ACQUIRED_TARGET EVENT_UNIT_TARGET_IN_RANGE and "stop"-order

no idea, never had this problem...
03-31-2010, 01:08 PM#3
Na_Dann_Ma_GoGo
Hmm that seems to be very costly regarding performance and issuing a lot stop orders will cause troubles as well.
Someone got another idea? ;o
03-31-2010, 01:15 PM#4
Tot
or:
- you remove 'Aatk' from all units.
- if an unit shall attack, replace it with a new one (has 'Aatk')
- if the attacker should no longer attack, remove 'Aatk'
03-31-2010, 01:18 PM#5
Michael Peppers
But I doubt you can order a unit to attack if it doesn't have the Attack ability.
Personally I'd give "root" and "uproot" abilities (or whatever they're called) a try, that could make things easier.
03-31-2010, 01:19 PM#6
Tot
Quote:
Originally Posted by Michael Peppers
But I doubt you can order a unit to attack if it doesn't have the Attack ability.
Personally I'd give "root" and "uproot" abilities (or whatever they're called) a try, that could make things easier.

to go around this, it has to be replaced with a new unit of same type, cause 'Aatk' can't be added...
03-31-2010, 01:50 PM#7
Kueken
Add the worker classification ingame via triggers, this way, the worker icon does not show up.
Collapse JASS:
call UnitAddType(u,UNIT_TYPE_PEON)
Note that units will flee now, when they are attacked, but you can disable this by setting the "can flee" value in objects editor to false.
03-31-2010, 02:32 PM#8
Na_Dann_Ma_GoGo
Ah now that's cool. Should solve all my problems ^_^
And yeh, I already turned "can flee" to false when I was playing around with the worker classification. Didn't know that was possible : )
+Rep 'fcourse.
04-01-2010, 02:06 AM#9
Here-b-Trollz
Workers fight back against other workers, so if everybody has this on then they will fight back (but I think they also come to arms at alarm, i.e., one peasant is attacked by one peon, all nearby peasants attack that peon.)

At least this was my experience with adding PEON classification to footmen.
04-01-2010, 08:56 AM#10
Kueken
I cannot share this experience, when I fighted other workers with my workers, they still fleed.
04-01-2010, 10:04 AM#11
Na_Dann_Ma_GoGo
Well should work just fine in my case anyways ;)