[EDITOR REQUEST] Attack is launched event


Back in the days when I was making Warcraft maps, I was always missing the Attack is launched event. We had “A unit is attacked”, which was triggered as soon as a unit acquired a target, and not when the unit actually attacked that taget, so this event could be abused by spamming the stop order (for example), and could launch many times in a quick succession. Furthermore, it was launching prior to the unit’s actual attacks, so if you wanted to spawn an additional missile, the event one was firing before the real one.

I tried to make a system to help me with that. It was basically a hashtable, containing every unit’s attack delay, and whenever a unit was attacked, it was starting a timer with the unit’s attack delay. And issuing any other order to the attacking unit was canceling the timer. So the event was launching as the timer expired.
But this way really clunky way of doing things, as it wasn’t taking into account the attack speed buffs the unit could’ve had, and also… I don’t remember how exactly had I coded it, but it’s possible that it also wasn’t taking into account if the unit got stunned (although I suppose this could’ve easily been fixed). Furthermore, it required a great effort to fill all the units’ attack delays into the hashtable, as it had to be done manually (I’m not sure if there isn’t a native function now that gets it automatically).

In the end I started using a damage detecting system, but it was quite clunky as well, as I had to give the ranged units using this event an instant attack, then nullify the damage they dealt, and spawn an artificial missile, with the unit’s damage. It was working, and you couldn’t really tell that it’s not the unit’s actual attack, but if for example you’d want to add an item to the game that gives you some bonus triggered upon your unit/hero launching an attack, then you’d need to artificially spawn the missiles for every single unit/hero on the map.

So it’d be really nice if we actually had an “Attack is launched event”. And changing the functionality of the current “A unit is attacked” wouldn’t be sufficient either as it’s also needed in different scenarios.
Also, I don’t know when exactly is the unit’s damage calculated, but if it’s upon launching the attack (instead of upon hitting the enemy), this event could use the damage amount native.

And while at it, could we get a “CreateMissile(source, target, damage, model, damageType, attackType, speed)” function? While it’s not too hard to program this myself, I do believe that a native function, would be able to achieve efficiency levels much higher than what I can with sliding systems and timers.
Or at least give the “Channel” ability option to spawn a missile :stuck_out_tongue:


The only thing I want is to have the trigger system be as powerful as the sc2 editor.


I think “Attack is launched” should be 1 event for melee and for ranged it should be like “Attack is launched” and “Attack is landed”.


That would be unnecessary as we already have the “A unit takes damage” event, which happens upon the attack landing.