channeling and triggered spell

Happy

Well-Known Member
Reaction score
71
hey guys....

ive got a question i cant figure out myself. i wanna make a spell that has channeling time. the longer the hero channels the more happens. but how can i detect whether the unit channels or not? and how can i detect WHEN the hero stopped channeling??

thanks in advance

greetz happy
 

Skippy

Active Member
Reaction score
39
I don't know if it is only way, but I do it like this:

Trigger:
  • Channel
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of (Your_caster)) Equal to (Order(channel))
        • Then - Actions
          • Caster is channeling, do whatever you want
        • Else - Actions
          • He stopped channeling

If you use blizzard, use (Current order of (Your_caster)) Equal to (Order(blizzard)) etc.
 

Ashlebede

New Member
Reaction score
43
There are two options. The one Skippy showed works, and I used it many times, but won't work if the casting is interrupted by something else than orders (such as stuns or sleeps).

The other option, the one that detects that, is to create another trigger with no events. When your unit "starts channeling the ability", in the actions you add the event "(My unit) stops channeling an ability" to the second trigger.

And then you could, for instance, clear the unit's child hashtable and remove the unit from whatever unit group you needed for a periodic event... if there is one.
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Upon him beginning to channel, I'd add him to a group that periodically checks if its units have stopped channeling.

EDIT: Ninja'ed.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
There are two options. The one Skippy showed works, and I used it many times, but won't work if the casting is interrupted by something else than orders (such as stuns or sleeps).

The other option, the one that detects that, is to create another trigger with no events. When your unit "starts channeling the ability", in the actions you add the event "(My unit) stops channeling an ability" to the second trigger.

And then you could, for instance, clear the unit's child hashtable and remove the unit from whatever unit group you needed for a periodic event... if there is one.

the bold part is pretty bad, because if you do as ashblade said you would add new events with every time you cast that spell and that would end up with leaks and bugs most probably.

but just a generic "unit stops channeling" event for all units would do it also.

one trigger which runs a timer when a unit starts channeling, one trigger which stops a timer when the unit stops channeling. this way you get the time in which the unit is channeling.
 

Ashlebede

New Member
Reaction score
43
@Accname

The two have a disadvantage... mine has to add an event to the trigger, which means it takes a little more time to execute the "Starts channeling an ability" part. However, yours would check if the unit is in a unit group every time a unit stops channeling an ability, which can happen often if there are many channeled spells. So no solution is perfect. u_u
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
no yours would add new events ever and ever again with every cast of the spell. (at least as how you said in the above post) this would end with a trigger firing numerous times when it should only once.
i guess you didnt meant it like that since you are an experienced member but as you said, adding new events with every cast, it would not just leak events but most probably it could end up bugging the game.
 

tommerbob

Minecraft. :D
Reaction score
110
Just use a condition to check what spell is being cast. That way it doesn't run each time a spell is cast, but only the right spell. Unless I'm missing something obvious here, that would be a very simple solution.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
look, ill demonstrate.

thats what ashblade wrote:
[...]
The other option, the one that detects that, is to create another trigger with no events. When your unit "starts channeling the ability", in the actions you add the event "(My unit) stops channeling an ability" to the second trigger.
[...]

thats what it would look like in GUI:
(This is a basic dummy ability which shall heal the caster when he ends channeling)
Trigger:
  • Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to HealChanneled
    • Actions
      • Trigger - Add to End <gen> the event (Unit - (Triggering unit) Stops casting an ability)

Trigger:
  • End
    • Events
    • Conditions
    • Actions
      • Unit - Cause (Triggering unit) to damage (Triggering unit), dealing -50.00 damage of attack type Spells and damage type Normal


the first time this skill is cast it would work pretty well.
but the second time it would be cast there would be 2 events in the trigger since the first one would not have been removed cause thats impossible in GUI.
now every time you cast this spell the trigger would run more often and heal more hitpoints. == Bug. (and event leak by the way)

but as i said, in Jass you might make it better with this method but it would require you to have the said skills and knowledge and i doubt that because otherwise (no offense) you wouldnt ask for such a question.
 

Ashlebede

New Member
Reaction score
43
Accname, of course, you have to remove the event after it happens. However, forgetful as I am, I would probably have forgotten to even add that in the trigger if I had to code it. :thup:
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
Accname, of course, you have to remove the event after it happens. However, forgetful as I am, I would probably have forgotten to even add that in the trigger if I had to code it. :thup:

you cant in GUI. and if the guy asking this question was a pro Jass scripter i doubt he would ask such a question.
 

Ashlebede

New Member
Reaction score
43
Really, you can't ? o_O

But you can't remove locations in GUI, either, and people still do it with Custom Script. u_u
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
look, i think what you are missing is the fact that we are trying to help people here to make their own wc3 maps.

i know, a pro jass scripter could do all this stuff but people reading such threads looking for answers do not.
and i am not just talking about happy, maybe he does know it, but there are alot of other newbies out there who might read this. even more probably since we always say use the search function before creating your own threads.

now what you gave as an answer was just a piece of bullshit for a beginner. yes, it might work but not for them.
they would just create some GUI triggers and add some events, and test all that stuff and see it works. the first time.

but then ingame they will notice it doesnt and they wont know why, get frustrated, start new threads here and such.

your answer just wasnt any helpful. you didnt said he has to remove the event, you didnt said he has to use jass, you didnt gave him anything which would actually help him. please keep in mind the reason for us to write information on this forum is to help the newbies, not the pros, the people you are talking to are most probable (of course not all) beginners and dont know stuff leak event leaks or such. and sarcasm wont help them either here but just hijack this thread and make it into a piece of spam.
 

Ashlebede

New Member
Reaction score
43
look, i think what you are missing is the fact that we are trying to help people here to make their own wc3 maps.

And you are missing the fact that I simply forgot to mention something. Really, you think I do it on purpose ?

Errare humanum est.

they would just create some GUI triggers and add some events, and test all that stuff and see it works. the first time.

It would still work, except it would make a lot of lag after a couple spell casts. But it would work.

and sarcasm wont help them either

What sarcasm?
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
you two need to stop post trollin'

happy I'd just do what skippy said.

the order unit takes while stunned is most certainly NOT a "spell channeled", it is "stand" as far as i remember, so i do believe, it should work
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top