• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Dummy Only Casts Spell Sometimes

Status
Not open for further replies.
Level 2
Joined
Mar 10, 2019
Messages
11
Whenever I have a trigger that uses a dummy to cast a spell I have two issues
1.) The spell will only cast every once in a while. Sometimes the spell works exactly as intended and other times the part that requires the dummy just doesn't go off.
2.) I can't get it to work at all without having a wait command (I assume it gives the dummy time to cast before being removed) but was told I should stay away from waits. What else can I do?


I have a few that look like this and they all have the same problem
  • Misdiretion
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to 920 Misdirection
    • Actions
      • Unit - Create 1 Dummy for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees
      • Set Misdirection = (Last created unit)
      • Unit - Add 920.1 Invisibility to Misdirection
      • Unit - Order Misdirection to Human Sorceress - Invisibility (Triggering unit)
      • Wait 0.25 seconds
      • Unit - Remove (Last created unit) from the game
 
Level 7
Joined
Apr 17, 2017
Messages
316
First of all, use starts the effect of an ability instead of begins casting. Because begins casting event fires the moment you cast the ability. Starts the effect of an ability fires when you start casting but after manacost. When you add a an expiration timer, you dont need to add wait and remove dummy as it does the job foe you. Also you are leaking a point there.Position of triggering unit. For more info check : Things That Leak
That will definitely fix your second issue. About the first one, try to use owner of triggering unit for unit events rather than triggering player. I can't say this for sure but, TriggeringPlayer is inconsistent when used in unit events rather than player events (or I may be simply wrong)
 
Last edited:
You can have one global dummy unit casting your spells, that is never removed. (always just change owner, etc)

But, the "Add an expiration timer" instead of wait would be a good fix, too.

And else, when really needing to "wait" in GUI with fighting MUI, you could use
  1. MUI Triggers with Waits ( simple, but only suited for minor stuff)
  2. MUI Spells Using Artificial Waits + Visualize: Dynamic Indexing (advanced, more powerful)
I can't say this for sure but, TriggeringPlayer is inconsistent when used in unit events rather than player events
When looking at JASS, one can see the native behind, and "A Unit Casting" etc turns out to be PLAYER_UNI_EVENT instead of pure UNIT_EVENT. For PLAYER_UNIT_EVENTS it's safe to use (TriggeringPlayer), and will just be the very same as (OwnerOf(TriggerUnit)). : )
For example "A Unit Enters Region" is not a PLAYER_UNIT_EVENT iirc, and then only (OwnerOf(TriggerUnit)) should be used.
 
Level 7
Joined
Apr 17, 2017
Messages
316
You can have one global dummy unit casting your spells, that is never removed. (always just change owner, etc)

But, the "Add an expiration timer" instead of wait would be a good fix, too.

And else, when really needing to "wait" in GUI with fighting MUI, you could use
  1. MUI Triggers with Waits ( simple, but only suited for minor stuff)
  2. MUI Spells Using Artificial Waits + Visualize: Dynamic Indexing (advanced, more powerful)

When looking at JASS, one can see the native behind, and "A Unit Casting" etc turns out to be PLAYER_UNI_EVENT instead of pure UNIT_EVENT. For PLAYER_UNIT_EVENTS it's safe to use (TriggeringPlayer), and will just be the very same as (OwnerOf(TriggerUnit)). : )
For example "A Unit Enters Region" is not a PLAYER_UNIT_EVENT iirc, and then only (OwnerOf(TriggerUnit)) should be used.
Yeah. Thanks for clearing that up. I just checked region events do not run player events which I think they should.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
To add on if you’re going to use 1 dummy unit for the whole map it does need to have its cast animation times all set to 0 and I believe it needs to have none movement so it can instantly turn and cast spells in any direction. Otherwise it will not successfully cast on every unit picked in a Unit Group - Pick action (for example).

If it’s not none movement it’s either 0 movespeed (hold shift + double click the field) or something else you can find by searching on this site.
 
Status
Not open for further replies.
Top