How to detect beginning of casting/channeling when using arrows on autocast?

Level 5
Joined
May 10, 2024
Messages
57
Why begin channeling/casting event is not triggered for cold/frost/black/etc arrows when these spells on autocast?

Events are working properly for autocast curse/slow/etc and are also working well when I use arrows manually. On top of that autocasting arrows does not go on cooldown but drains mana...
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
That's the limitation of the engine when it comes to orb effects.
The way I handled this scenarios was to:
  • Create a trigger that reacts when player turns autocast of the ability on and off - in this trigger, I keep track of the ability's on/off state. Turning on/off can be detected via an 'issued order with no target' event.
  • Create a second trigger that fires when 'Unit is attacked'. Check if the autocast is on and if unit has sufficient mana to be able to autocast the attack. If all checks out, you know the unit would auto-cast the spell on its attack.

If you want to start cooldown on the ability, I think you would need to calculate the time it takes the unit to fire its attack after triggering the 'Unit is attacked' event - in simple terms, the event is fired when unit starts drawing an arrow from its quiver, not when it shoots the arrow.
So you need to calculate yourself the delay between drawing arrow and actually shooting it. Then run some timer or something else that is precise, wait that delay, and after it expires, start the ability's cooldown.
 
Top