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

Detect if an ability is currently on auto-cast

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I do not think you can directly. You can keep track of if an ability is set on auto cast since activating and deactivating auto cast sends an order and you know the initial state of auto cast for the unit from the object editor. This will obviously need a trigger system.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
As I said, you can keep track of auto cast status. You know the initial state (as defined in object editor) and can detect any state changes (in the form of orders with no target). All that is needed is somewhere to store the current state than can be easily obtained from the unit (eg a HashTable) and you can recall if an ability auto cast is on or off at any time.
 
Level 8
Joined
Jul 8, 2013
Messages
249
Typically I use two triggers like this:

  • Add Unit to Autocasting Group
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(blackarrowon))
    • Actions
      • Unit Group - Add (Triggering unit) to AutocastingBlackArrow
  • Remove Unit from Autocasting Group
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(blackarrowoff))
    • Actions
      • Unit Group - Remove (Triggering unit) from AutocastingBlackArrow
Then all you need to do is check if the unit is in that unit group and you know if it's autocasting. One problem to avoid: if you have two different abilities with blackarrowon or off as their order to autocast then of course this trigger will add units autocasting either to the group.

Oh and if the unit starts off with the ability autocasting by default, then one just needs to add that unit to the unit group when it is created.
 
Last edited:
^This was what DSG was telling you, though I don't get why you posted this:
Yeah. I already created the triggers, and simply use a dummy ability to keep track.
When the ability is used it is set to level 2, and if used again it is set to level 1.
That way I can change the description. You know, on/off or something like that.
But it would have been nice with the lovely auto-cast borders ;)
 
Status
Not open for further replies.
Top