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

Channel Cooldown

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
I've made an ability based on the creep "Channel" ability. I use it with a trigger to do x. And it works! However, when the ability has been used, it doesn't go on cooldown, despite the fact that i have set the cooldown of the channel ability to 15 seconds.
Wat. Help me?
 
Level 7
Joined
May 11, 2010
Messages
278
Are you moving the unit isntantly or ordering it to stop?

In fact, i'm doing precisely that.

  • Unit - Move (Triggering unit) instantly to TempPoint2
  • Knockback Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Back Bonk
    • Actions
      • Set unit = (Target unit of ability being cast)
      • Set Force = (Real((Strength of (Triggering unit) (Exclude bonuses))))
      • Set Weight = (Real((Agility of unit (Exclude bonuses))))
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempPoint2 = (Position of unit)
      • Set KnockAngle = ((Angle from TempPoint to TempPoint2) + 180.00)
      • Set KnockDistance = (((Force x 60.00) / Weight) x 0.02)
      • Set KnockDuration = 0.50
      • Hashtable - Save KnockDistance as (Key distance) of (Key (Target unit of ability being cast)) in KnockTable
      • Hashtable - Save KnockAngle as (Key angle) of (Key (Target unit of ability being cast)) in KnockTable
      • Hashtable - Save KnockDuration as (Key duration) of (Key (Target unit of ability being cast)) in KnockTable
      • Unit Group - Add unit to KnockGroupBlink
      • Unit - Turn collision for unit Off
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Knockback Loop Blink <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Knockback Loop Blink <gen>
        • Else - Actions
      • Set TempPoint2 = (TempPoint2 offset by 100.00 towards (KnockAngle + 180.00) degrees)
      • Unit - Move (Triggering unit) instantly to TempPoint2
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoint2 using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
  • Knockback Loop Blink
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KnockGroupBlink and do (Actions)
        • Loop - Actions
          • Set KnockAngle = (Load (Key angle) of (Key (Picked unit)) from KnockTable)
          • Set KnockDistance = (Load (Key distance) of (Key (Picked unit)) from KnockTable)
          • Set KnockDuration = (Load (Key duration) of (Key (Picked unit)) from KnockTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KnockDuration Greater than 0.00
            • Then - Actions
              • Set TempPoint2 = (Position of (Picked unit))
              • Set TempPoint = (TempPoint2 offset by KnockDistance towards KnockAngle degrees)
              • Unit - Move (Picked unit) instantly to TempPoint, facing (KnockAngle + 180.00) degrees
              • Hashtable - Save (KnockDuration - 0.02) as (Key Duration) of (Key (Picked unit)) in KnockTable
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in KnockTable
              • Unit Group - Remove (Picked unit) from KnockGroupBlink
              • Unit - Turn collision for (Picked unit) On
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in KnockGroupBlink) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 7
Joined
May 11, 2010
Messages
278
Use the "ends casting" event and store caster and target before. When "starts effect" occurs, the ability has not finished yet its internal mechanisms. So unless you have a channeling ability, prefer "ends casting".
I tried this, it causes the trigger to not execute.

You could use a 0 timer to fix that.
What exactly is a 0 timer?
 
Level 1
Joined
Apr 24, 2009
Messages
44
Keep the Starts the effect of an ability event.
Set the unit's X and Y position respectively, instead of using "Move <unit> instantly". By setting X and Y independently it won't affect the unit's current actions and it won't cancel the spell going into cooldown.
 
Level 7
Joined
May 11, 2010
Messages
278
I presume that's a jass function? I don't know any jass at all :p
I made a temporary solution that's godawful but it works (disable ability for player, enable after 15 seconds (using hashtables to make it MPI))
I forgot to specify, it has to be MPI, but not MUI. Any player can only control one unit with this ability.

  • Blink cooldown
    • Events
    • Conditions
    • Actions
      • Set player = (Owner of (Triggering unit))
      • Player - Disable Back Bonk for player
      • Hashtable - Save 15.00 as (Key cooldown) of (Key (Owner of (Triggering unit))) in blinkCDtable
      • Player Group - Add player to playerGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Blink Cooldown loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Blink Cooldown loop <gen>
        • Else - Actions
  • Blink Cooldown loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in playerGroup and do (Actions)
        • Loop - Actions
          • Set blinkCD = (Load (Key cooldown) of (Key (Picked player)) from blinkCDtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • blinkCD Greater than 0.00
            • Then - Actions
              • Set blinkCD = (blinkCD - 0.50)
              • Hashtable - Save blinkCD as (Key cooldown) of (Key (Picked player)) in (blinkCDtable)
            • Else - Actions
              • Player - Enable Back Bonk for (Picked player)
              • Player Group - Remove (Picked player) from playerGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of players in playerGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 1
Joined
Apr 24, 2009
Messages
44
Hm, didn't know it's not present in GUI.

Try this (put it in 2 custom script actions):
call SetUnitX(GetTriggerUnit(), GetLocationX(udg_TempPoint2))
call SetUnitY(GetTriggerUnit(), GetLocationY(udg_TempPoint2))
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
This is the story behind the mystery.

When you are calling this function;
  • Unit - Move (Triggering unit) instantly to (Center of (Playable map area))
It will interrupt the current order of the unit, making the unit cancels its cast BUT it has moved the unit to the designated location - this is why the unit is moved, but the spell never goes on cooldown because the spell cast is interrupted by this function.

We could use the SetUnitX/Y function BUT as we know, this function ignores pathing, therefore you could perhaps stuck in the middle of the target location instead of beside it.
Also, you could be stuck on side cliffs - therefore not a good idea.

And why Timer works ?
It is because Warcraft III uses a single-threaded mechanism which only allows process to be ran on one way.
It is not because of that Timer.


Although we do need to wait a little, before the function is put into action.
It's mystery (to me at least) why we need to wait a 0 second... it means, we have to wait for ? NOTHING.
But it works - weird.

It doesn't obey the single-threaded because this trigger fails;
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Spell
    • Actions
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit - Move (Triggering unit) instantly to (Position of (Target unit of ability being cast))
This trigger still moves the unit and the spell never been cast.

By doing this way, the caster has moved AND has cast the spell, only then it is moved.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
A 0-timer is just a very short timer. I still insist on the "ends casting" event. There could be more actions inside the spell code interrupting the order, including calling other triggers through events with arbitrary functionality. Just let wc3 finish its stuff, if you do not know exactly what you do. One also actually uses custom events to wrap these quirks.
 
Level 7
Joined
May 11, 2010
Messages
278
@Maker: I did check it, however it seems a bit too complicated. Defskulls solution works perfectly and I understand it, wich can be a good thing when making triggers :p

@Defskull: thanks for the explanation and the solution, it works perectly :)

@Waterknight: Well except for you know, when i did that the trigger didn't execute.
 
Status
Not open for further replies.
Top