• 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.

Custom spell

Level 5
Joined
Aug 2, 2015
Messages
69
Whats wrong with this triggering spell?
If its not clear what I want it to do: Trap unit inside a shell up in the air for few secs
  • [TRIGGER]
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A ground unit) Equal to True
        • Then - Actions
          • Unit - Set Unit: (Target unit of ability being cast)'s Integer Field: Targeted as ('utar') to Value: 4
          • Wait 0.50 seconds
          • Animation - Change (Target unit of ability being cast) flying height to 233.00 at 45.00
        • Else - Actions
      • Set VariableSet Encapsulate = (Target unit of ability being cast)
      • Trigger - Turn on Encapsulate tick <gen>
      • Special Effect - Create a special effect attached to the body of Encapsulate using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Set VariableSet EncapsulateVFX = (Last created special effect)
      • Wait 5.00 seconds
      • Trigger - Turn off Encapsulate tick <gen>
      • Special Effect - Destroy EncapsulateVFX
      • Animation - Change (Target unit of ability being cast) flying height to 0.00 at 45.00
      • Wait 0.50 seconds
      • Unit - Set Unit: (Target unit of ability being cast)'s Integer Field: Targeted as ('utar') to Value: 2
      • Set VariableSet Encapsulate = No unit
[/TRIGGER]
Atm it does nothing, (Ive made sure enemy is actually casting this)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
We can't see your Encapsulate tick trigger, which could be important for debugging it.

Anyway, a Wait is a very unsafe Action to rely on in Spell related triggers (and other types as well).
1) Waits are imprecise and need to be synced when playing online.
2) Waits have a minimum time (~0.25). I think it only applies to online play.
3) A lot of the Event Responses in this game act like global variables which are shared between other triggers which can be overwritten.
4) Some Event Responses will simply get unset and have no value. In this case, (Target unit of ability being cast) no longer exists after your first Wait.

I see you attempted to fix these issues with variables, but you're failing to use your Encapsulate variable properly.

Here's an updated version of the trigger:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Set VariableSet Encapsulate = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Encapsulate is A ground unit) Equal to True
        • Then - Actions
          • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 4
          • Wait 0.50 seconds
          • Animation - Change Encapsulate flying height to 233.00 at 45.00
        • Else - Actions
          • Wait 0.50 seconds
      • Trigger - Turn on Encapsulate tick <gen>
      • Special Effect - Create a special effect attached to the body of Encapsulate using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Set VariableSet EncapsulateVFX = (Last created special effect)
      • Wait 5.00 seconds
      • Trigger - Turn off Encapsulate tick <gen>
      • Special Effect - Destroy EncapsulateVFX
      • Animation - Change Encapsulate flying height to (Default flying height of Encapsulate) at 45.00
      • Wait 0.50 seconds
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 2
I made it so the trigger always Waits the 0.50 seconds regardless of a Ground/Flying unit. This makes more sense to me but maybe you had your reasoning. I made sure to Set the Encapsulate variable before ANY Waits occur and I made sure that this variable was referenced throughout the entire trigger. I got rid of the unsetting of the Encapsulate variable as that's unnecessary.


Also, I think you probably want the 0.50 second Wait for the Encapsulate flying height to be separated from the whole process. Currently it's delaying the rest of the trigger by 0.50 seconds. You could fix this problem like so:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Set VariableSet Encapsulate = (Target unit of ability being cast)
      • Trigger - Run Encapsulate Ground Unit (checking conditions)
      • Trigger - Turn on Encapsulate tick <gen>
      • Special Effect - Create a special effect attached to the body of Encapsulate using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Set VariableSet EncapsulateVFX = (Last created special effect)
      • Wait 5.00 seconds
      • Trigger - Turn off Encapsulate tick <gen>
      • Special Effect - Destroy EncapsulateVFX
      • Animation - Change Encapsulate flying height to (Default flying height of Encapsulate) at 45.00
  • Encapsulate Ground Unit
    • Events
    • Conditions
      • (Encapsulate is A ground unit) Equal to True
    • Actions
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 4
      • Wait 0.50 seconds
      • Animation - Change Encapsulate flying height to 233.00 at 45.00
      • Wait 5.50 seconds
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 2
This Wait will run separately and not delay the Cast trigger. This also has the added benefit of only messing with the Targeted field for the Ground unit.


But ideally, you would get rid of the Waits and put most of your logic into the Tick trigger. This trigger would be toggled on/off like so:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Trigger - Turn on Encapsulate tick <gen>
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Trigger - Turn off Encapsulate tick <gen>
 
Last edited:
Level 5
Joined
Aug 2, 2015
Messages
69
We can't see your Encapsulate tick trigger, which could be important for debugging it.

Anyway, a Wait is a very unsafe Action to rely on in Spell related triggers (and other types as well).
1) Waits are imprecise and need to be synced when playing online.
2) Waits have a minimum time (~0.25). I think it only applies to online play.
3) A lot of the Event Responses in this game act like global variables which are shared between other triggers which can be overwritten.
4) Some Event Responses will simply get unset and have no value. In this case, (Target unit of ability being cast) no longer exists after your first Wait.

I see you attempted to fix these issues with variables, but you're failing to use your Encapsulate variable properly.

Here's an updated version of the trigger:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Set VariableSet Encapsulate = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Encapsulate is A ground unit) Equal to True
        • Then - Actions
          • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 4
          • Wait 0.50 seconds
          • Animation - Change Encapsulate flying height to 233.00 at 45.00
        • Else - Actions
          • Wait 0.50 seconds
      • Trigger - Turn on Encapsulate tick <gen>
      • Special Effect - Create a special effect attached to the body of Encapsulate using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Set VariableSet EncapsulateVFX = (Last created special effect)
      • Wait 5.00 seconds
      • Trigger - Turn off Encapsulate tick <gen>
      • Special Effect - Destroy EncapsulateVFX
      • Animation - Change Encapsulate flying height to (Default flying height of Encapsulate) at 45.00
      • Wait 0.50 seconds
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 2
I made it so the trigger always Waits the 0.50 seconds regardless of a Ground/Flying unit. This makes more sense to me but maybe you had your reasoning. I made sure to Set the Encapsulate variable before ANY Waits occur and I made sure that this variable was referenced throughout the entire trigger. I got rid of the unsetting of the Encapsulate variable as that's unnecessary.


Also, I think you probably want the 0.50 second Wait for the Encapsulate flying height to be separated from the whole process. Currently it's delaying the rest of the trigger by 0.50 seconds. You could fix this problem like so:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Set VariableSet Encapsulate = (Target unit of ability being cast)
      • Trigger - Run Encapsulate Ground Unit (checking conditions)
      • Trigger - Turn on Encapsulate tick <gen>
      • Special Effect - Create a special effect attached to the body of Encapsulate using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Set VariableSet EncapsulateVFX = (Last created special effect)
      • Wait 5.00 seconds
      • Trigger - Turn off Encapsulate tick <gen>
      • Special Effect - Destroy EncapsulateVFX
      • Animation - Change Encapsulate flying height to (Default flying height of Encapsulate) at 45.00
  • Encapsulate Ground Unit
    • Events
    • Conditions
      • (Encapsulate is A ground unit) Equal to True
    • Actions
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 4
      • Wait 0.50 seconds
      • Animation - Change Encapsulate flying height to 233.00 at 45.00
      • Wait 5.50 seconds
      • Unit - Set Unit: Encapsulate's Integer Field: Targeted as ('utar') to Value: 2
This Wait will run separately and not delay the Cast trigger. This also has the added benefit of only messing with the Targeted field for the Ground unit.


But ideally, you would get rid of the Waits and put most of your logic into the Tick trigger. This trigger would be toggled on/off like so:
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Trigger - Turn on Encapsulate tick <gen>
  • Encapsulate
    • Events
      • Unit - Sunblade Arch Mage 0177 <gen> Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Encapsulate
    • Actions
      • Trigger - Turn off Encapsulate tick <gen>
Perfect, as always :)

cheerio!
 
Top