• 🏆 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!

[Solved] Turn on the ability to auto attack with Ability for defined time

Status
Not open for further replies.
Level 2
Joined
Mar 27, 2020
Messages
16
[Solved] Attack interval is buggy to triggeror something. I solved the problem with this (see Attached File).

Original message:

Hey, I want to make a spell that a specific hero CAN auto attack. So by default he should not be able to attack.By pressing the ability (instant selfcast) he should attack very fast for 4 seconds, then stops again.

So far my way to achieve this was like this:
I set the attack cooldown of the hero unit to a very high level so he wont attack. Then by clicking the ability I set the "Unit - Set Attack Interval" to a desired attack speed level via triggers.

It works pretty fine, but I don't know how to stop this trigger, or how to set it back to highvalues. The "wait" action doesn't seem to work, but I guess I don't understand the system.

I am completely new to modding so please explain this like you would to a toddler.

Btw, you guys here do awesome work, I didn't know how big the modding community was. Its crazy what you have achieved here!
 

Attachments

  • Attack enabling.png
    Attack enabling.png
    11.2 KB · Views: 21
Last edited:
Level 6
Joined
Dec 31, 2017
Messages
138
Set attack interval for (Triggering unit) to low value
Wait x seconds
Set attack interval for (Triggering unit) to high value

This should work if every unit on the map can be affected by only one instance of this trigger at any moment of time.
 
Level 6
Joined
Dec 31, 2017
Messages
138
Hm, for me it works just fine. The only problem I've encountered is Blizzard changing weapon indexing for this function.
So instead of
  • Unit - Set Attack Interval of (Triggering unit) to 0.20 for weapon index: 1
  • Unit - Set Attack Interval of (Triggering unit) to 0.20 for weapon index: 2
one should use
  • Unit - Set Attack Interval of (Triggering unit) to 0.20 for weapon index: 0
  • Unit - Set Attack Interval of (Triggering unit) to 0.20 for weapon index: 1
But zero isn't permited as a parameter in GUI.
Soulution would be:
  • Custom script: call BlzSetUnitAttackCooldown( GetTriggerUnit(), 0.20, 0 ) // for (Casting unit)
  • Custom script: call BlzSetUnitAttackCooldown( GetSpellTargetUnit(), 0.20, 0 ) // for (Target unit of ability being cast)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Another solution if you want to "Disarm" a unit is to add the Cargo Hold (Orc Burrow) ability to the unit. While a unit has this ability it cannot attack. Simply remove the ability when you wish to enable the attack again.
 
Status
Not open for further replies.
Top