• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Break Channel, Break spell

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
So I have a few channeling spells that, if the channeling is broken, I want the spell to end. Of course I'm having enough trouble making a spell MUI/MPI and looping, but I still have to find a way to make it so the effect of the spell ends when the caster stops channeling.

How do you do this? I was looking for a "Finishes Casting an Ability" type if statement condition, but couldn't find one.
 
Level 6
Joined
Sep 5, 2007
Messages
264
You create a trigger using "Generic unit stops casting an ability".

Or you can use a periodic timer that checks the caster's current-order-id IE: if the caster isn't using the right order (EG: "channel", etc.) then terminate channeling functions. To do this you use:
JASS:
if (GetUnitCurrentOrder(<unit>) != OrderId(<ability order-id>)) then
    <insert channeling termination code>
endif

Hope this is what you're after. :thumbs_up:
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Unstable Concoction
Based on Channel.

When it goes into effect, a unit (e01N) is created on top of the target unit. Then the variables Caster (the dummy) and Target are saved to the game cache. A new timed trigger is created every 0.1 seconds, and the newly created unit also has a 6 seconds timed life, then its pathing is removed, it's set to invulnerable and gains Aloc. Now, another trigger is created which can be called by either every 0.5 seconds or when a spell has finished casted. Finally the Hero, Target and Caster units are saved to the cache.

The trigger that is run every 0.1 seconds: Recovers Caster and Target from the cache, checks if the enemy has less than 1 life, or it is not visible, the timer is paused. If neither of those two conditions is met, then set the Caster's X and Y to be equal to the Target's X and Y. This is done to gain vision of the enemy unit.

The trigger that is run every 0.5 seconds: Checks if it has been called because the unit finished the spell cast of Unstable Concoction, if its true then recover Hero, Target and Caster from the game cache, create a unit (e00C) on top of the hero, add a Storm Bolt ability (A0JD) with its level equal to the number of times this trigger has been called-1 (with 1 being the lowest). Then it is told to use it on Target. Finally the unit is given Aloc, and given a timed life of 2 seconds. Then if the Caster unit is still alive, kill it then disable the trigger. Do note that there's an if at the beginning of this trigger, if it's not met then this trigger does nothing.

Hmm, a 2 seconds timed life of the dummy unit casting the storm bolt means that if the enemy is over 3000 units from you the "XXX has commited suicide" may happen. It needs a running hero at 522 speed (5 seconds channel: 2610 units, add casting range + buffer + the time spent to get to the enemy hero and you can see it can travel over 3000 units)

From here
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
These sources have been really helpful to recieve, as I'm making spells and I do need an idea on how certain spells work.

However, I wasn't interested in channel then break and fire. You see, my channel has a loop, and I want that loop to break when the channel ends. Every loop is either heal or damage per second. If the channeling breaks, it's only appropriate that the units should stop healing or being damaged.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The concept of Unstable Concoction should show you how to detect the channeling break.
What you do between the start of the channeling and the break is up to you.
 
Status
Not open for further replies.
Top