Replace the Event with this:
-
Events
-
Unit - A unit Starts the effect of an ability
"Begins casting..." happens before the spell actually executes, and is interruptible by the user by canceling the order. The unit's orders can also get interrupted by a stun for example so you really shouldn't be relying on this Event for this type of effect. Instead, you want to use the "Starts the effect..." Event which happens when the ability has successfully executed (mana spent, cooldown started, effects of the ability occur).
And replace all instances of (Casting unit) with (Triggering unit).
Additionally, make sure that your Dummy unit can actually cast Carrion Swarm. This means that the Dummy has the Ability learned and the abilities Cast Range, Mana Cost, Requirements, etc are all setup properly.
You should also make sure that your Dummy unit is setup correctly. I recommend basing it off of the Locust unit and then modifying it with the following stats:
Movement Speed: 0
Movement Type: None
Attacks Enabled: None
I recommend looking into the basics of triggering (links in my signature). The Wait action is generally not a good option for custom spells since a lot of information can get lost/replaced after the Wait. Waits are generally reserved for triggers that can't have multiple instances running at the same time.
For example, an Event like this only happens once a game and doesn't set any Event Responses, so it's fairly safe to use a Wait in it without running into issues:
-
Events
-
Time - Elapsed game time is 10.00 seconds
-
Actions
-
Wait 3.00 seconds
But a trigger like yours with an Event that runs WHENEVER a unit casts an ability can happen multiple times and there can be multiple instances of it running at the same time. This can complicate things. For starters, this Event sets these Event Responses: Casting unit, Triggering unit (same as Casting unit), Target unit of ability being cast (if able), and Target point of ability being cast (if able).
Understand that out of these 4 Event Responses only Triggering unit will remain usable after a Wait action. Triggering unit is a special exception that works like a local variable that will remain the same throughout the trigger no matter what. The other Event Responses will either get unset (losing their data) or act as global variables which can have their data replaced with new data (potentially unwanted data) from the use of other triggers that share these same Event Responses.
There's many methods to combat these issues:
- Use Event Responses which don't lose their data like Triggering unit. This is sometimes not possible as Triggering unit is the only real exception.
- Use local variables which retain their data throughout the trigger (not intended for GUI users but still usable with Custom script).
- Don't use Waits at all and instead use some form of Indexing with Timers/Periodic Intervals in order to mimic the behavior of a Wait while retaining all of the necessary information. This is usually what custom spells require especially if you want some sort of time component to them (damage over time, delays, etc).
- Code your triggers in Lua/Jass for far greater control (more advanced).
Keep in mind that if you aren't using Waits then you generally don't have to worry about issues regarding Event Responses. That being said, it's possible to overwrite Event Responses and cause problems inside of a trigger even without any Waits. This can happen if the Actions of one trigger cause another trigger to run and both triggers use the same Event Responses.
After you've gotten a better understanding of how this stuff works you can move on to memory leaks, which there are many of in your current trigger. These aren't the end of the world and can often times be harmless/ignored but it's still something to be aware of. Removing memory leaks can help improve your map's performance since you'd be getting rid of information that is no longer needed but is still being stored in the game's memory. To simplify it you can think of it like emptying your Recycle Bin on Windows. Link in my signature.