• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Disable Autoattacks

Status
Not open for further replies.
Level 8
Joined
Nov 20, 2011
Messages
202
Hello,
I was experimenting a lot with the
JASS:
native UnitAddType(_, UNIT_TYPE_PEON)
to disable autoattacks but if both units have the worker classification it does not work. I also tryed to add add the ckassification just in time but the native needs some to work.

So are there any other ideas how to disable autoattacks?
 
Level 8
Joined
Nov 20, 2011
Messages
202
Huh? What do you mean with "if both units have the worker classification"?

You can also set Acquisition range to 0 to disable auto-engage. However, this will make units retaliate when attacked, whereas workers will do nothing, so it's not exactly the same.

Ever attacked a worker with another worker? They other worker don't runs away he attacks you.

To set the Acquisition range to 0 isn't a solution since i also want to disable retaliate on attack.
 
Level 25
Joined
May 11, 2007
Messages
4,651
Classify both workers as mechanical and only allow them to attack organic units.

Or simply just remove the attacks alltogheter, if you have to use workers to attack you're probably dead anyhow.
(Militias are an exception)
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
This is a small workaround, but it might be worth it if you are as desperate as considering alliance changes for that:

Give both workers a channel ability with a very high channel time (set animation to "stand") hidden in a disabled spellbook. When the workers have no order (if GetUnitCurrentOrder(unit) == 0 then), make them use the channel ability.

This will effectively make them ignore all units unless manually ordered.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Even if you summon a critter, no one attacks it. I recommend to check if it's something which can be assigned in triggers or if it can only be changed in Object Editor.

By the way, is this a single-player game where you don't want to auto-attack the enemy AI-controlled units, or is it a multiplayer game where you don't want the players to auto-attack each other?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
OK the critter thing would be pretty complex. www.wc3c.net/showthread.php?t=81742 talks about what it would involve on the section regarding mechanical critters.

My original idea, to have the enemies be allies, can be achieved by allowing the spells to target allies as well - but put anti-backstabs on the map if you want to prevent civil wars. But it is also complex.
 
Level 8
Joined
Nov 20, 2011
Messages
202
First of all I why i need to disable autoattacks?
I have my own channeling / cast system in the AOS map HotN for serveral stuff like capturing points: https://www.youtube.com/watch?v=KR0IwuKGOcg

Some background: The unit that captures doesn't cast a spell or anything like that, I just set the animation by trigger (SetUnitAnimationByIndex(...)). So if a enemy attacks me while capturing my hero strikes bad which is not what I want. So yes there are a lot of ways to prevent striking back like issue stop order, start a channel ability pause the unit ect. But all of this "solutions" stop the current animation or at least reset it, what looks bad and is not what i want.
Additionaly to the channel system i want to prevent that the heros act on it's own. There is a reason why there is no auto attack in dota 2, lol, hon ect.

So Silents solution is pretty nice to prevent unwanted hero behavior, but nevertheless my hero will still strike back on attack. So i use now a pretty uncommon solution but it is simple.

The stun from the ability Stormbold prevents the attacked unit from striking back, and the good thing is, it does NOT cancel the current animation. With a dummy caster system some changes on Stormbold and the native UnitRemoveBuff(...) i can time the stun perfectly. So all my problems are solved :)

Thank you for you help and Iam open for other solutions.
 
Last edited:

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Out of dumb curiosity, have you tried the invisibility technique at the same experiment as the peon technique? Maybe the 2 combined somehow work.

Otherwise, if the enemies are put into a "passive alliance" and they right-click each other, the order is "smart" and can be changed to an attack order if you give it at least a 0 second timer delay.
 
Level 8
Joined
Nov 20, 2011
Messages
202
Out of dumb curiosity, have you tried the invisibility technique at the same experiment as the peon technique? Maybe the 2 combined somehow work.
Yes i tryed, does not work :/

Otherwise, if the enemies are put into a "passive alliance" and they right-click each other, the order is "smart" and can be changed to an attack order if you give it at least a 0 second timer delay.

Iam not sure what a "passive alliance" is. However there is still the problem that i can not set "enemy" for the target of a spell.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Did you use the Jass SetPlayerAlliance or the BJ found in GUI? Because the GUI will flag spells and not simply the passive alliance.

Edit: If you already did that, try this:

JASS:
                call SetPlayerAlliance(Player(i),Player(j), ALLIANCE_PASSIVE, true )
                call SetPlayerAlliance(Player(i),Player(j), ALLIANCE_SHARED_SPELLS, false )

It sure beats the alternatives, if it works!
 
Last edited:

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Ok I have come across a possible solution. What if, instead of the permanent invisibility option, the heroes are ordered to Wind Walk? If they are Wind Walked, they can break the wind walk by casting an ability or by manually attacking. Set the WW duration to -1. When the unit is issued a stop or move order, simply have it cast wind walk again.

You would have to share vision with each other so you couldn't have invisible units, and the units would be translucent unless there is a way to fix that.
 
Status
Not open for further replies.
Top