• 🏆 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!

Cooldown dummy for passive ability

Status
Not open for further replies.
Level 3
Joined
Apr 4, 2020
Messages
31
Hello,

i'm currently trying to implement a cooldown for passive ability.
The following trigger is a bit changed to my original, which worked but was only made for 1 level of the passive.
I decided to add levels so i had to change it a bit.
The passive itself does nothing but buffs all the other spells i have. My idea was, passive is ready, then improve spell. If spell is cast, put passive on cd:
  • ChargedRdy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lira Windrun
      • (Ability Cooldown Remaining of (Triggering unit) for ability Charged (pass)..) Equal to 0.00
      • (Level of Charged (pass) for (Casting unit)) Greater than 0
    • Actions
      • Custom script: local unit u
      • Custom script: set u = GetTriggerUnit()
      • Set VariableSet SC_Charged = Charged (pass)
      • Set VariableSet SC_Charged_lvl = (Level of Charged (pass) for (Triggering unit))
      • Wait 0.50 seconds
      • Unit - Add Charged (Cooldown dummy) to (Triggering unit)
      • Unit - Set level of Charged (Cooldown dummy) for (Triggering unit) to (Level of SC_Charged for (Triggering unit))
      • Unit - For Unit (Triggering unit), start cooldown of ability Charged (Cooldown dummy) " over "(Ability Cooldown of (Triggering unit) for ability SC_Charged, Level: SC_Charged_lvl.) seconds.
      • Unit - Remove Charged (pass) from (Casting unit)
      • Wait (Real((Integer((Ability Cooldown of (Triggering unit) for ability SC_Charged, Level: SC_Charged_lvl.))))) seconds
      • Custom script: call UnitRemoveAbility(u, 'A01I')
      • Custom script: call UnitAddAbility(u, 'A01J')
the dummy passive im using is reincarnation, since it shows a cd when used.
What happens is the following:
The dummy passive is added but my hero keeps the original. The CD that should be added is 15 for level 1 (15, 10, 5) but he always starts at 10 sec.
I already changed
  • Unit - Remove Charged (pass) from (Casting unit)
to triggering unit which only did more harm than good (now it won't even add the dummy passive)

Anyone knows what i'm overlooking?

Thanks in advance
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,536
You can use the Exhume Corpses ability as a passive ability that can have it's cooldown set/started just like Reincarnation. It's the better choice since it doesn't have any effects. Just make sure to set it's Duration to 0.

Regarding your trigger, there's no reason to use local variables in it. Triggering unit acts like a local variable (it's the only Event Response that does), so you can get rid of all of the custom script stuff and just reference Triggering Unit throughout.

Here's a problem:
  • Unit - Remove Charged (pass) from (Casting unit)
You can't reference Casting unit after a Wait. Change this to Triggering unit.

Also, SC_Charged and SC_Charged_lvl can cause MUI problems since they're global variables and you're using Waits. They don't look necessary anyway.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,536
Looks like you've already solved it, but for future reference, there's actually a handy tutorial that walks through what Uncle described: Passive ability with cooldown - Best method!
Well, that's actually a bit outdated now since we have the "Start cooldown of ability..." Action. The Exhume Corpses ability is still useful though because of it's passive cooldown mechanics. Now all you need is that Ability and the Action and you're good to go.
 
Level 3
Joined
Apr 4, 2020
Messages
31
Just one more thing:
The dummy passive is added but my hero keeps the original. The CD that should be added is 15 for level 1 (15, 10, 5) but he always starts at 10 sec.
Any idea why this happens?
 

Attachments

  • CD_Charged.png
    CD_Charged.png
    37.1 KB · Views: 43
Status
Not open for further replies.
Top