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

[Spell] Creating a Passive with Cooldown

Status
Not open for further replies.
Level 8
Joined
Mar 20, 2011
Messages
264
Trying to create passive abilities (for units and items) which have a cooldown.

Example:
Deals x damage when attacked, with a cooldown of x seconds.
Regains x HP when attacking, with a cooldown of x seconds.
Attacks twice every x seconds.
ETC.

The only idea I had was to create a trigger which would disable itself for x seconds but it seems leaky.
Any help?

Also, how do you add a passive cooldown visual?
 
Level 10
Joined
Apr 4, 2010
Messages
286
Here's one concept. There might be other ways of doing this. This is best for a unique hero unit, not something you're going to have multiples of because the triggers will get messy.


Ability 1: A dummy passive ability (based on Stormhammers or something). Really just a tooltip describing the effect for the player.

Ability 2: Active ability with a passive icon. This is the ability that actually does the thing. Give this the same icon, tooltip and button placement as Ability 1 so it looks like they're the same ability to the player. Give this the cooldown you want the effect to have. Remove any mana cost and hotkey.
(If you're doing the actual effect with triggers, this doesn't need to actually do anything except be active and have a cooldown.)

Trigger 1: Start of map, disable Ability 2.

Trigger 2: When <event happens>, enable Ability 2, disable ability 1, issue order to unit to cast Ability 2. Turn off this trigger.

Trigger 3: When Ability 2 is cast, start a countdown timer with duration equal to the cooldown. Any trigger-driven effects of the spell also happen here.

Trigger 4: When the countdown timer expires, turn on Trigger 2. Disable Ability 2 and enable Ability 1.


Edit to add - Here's how all this will look to the player:

While the ability is ready, the passive icon is visible. They can read the tooltip, and clicking it doesn't do anything (because it's a passive).
While the ability is on cooldown, the active icon is visible and the player can see the cooldown in progress. They can read the tooltip. Clicking it doesn't do anything (because it's on cooldown).
 
Last edited:
Level 20
Joined
Aug 29, 2012
Messages
832
What I would do is:

1. Create a dummy invisible ability and give it to the unit that has the passive
2. Create a trigger that creates the effect of your passive (deal X damage when attacked etc.) that only fires when the unit has the ability mentioned in step 1 and once the effect is complete, remove said ability (so that it won't trigger again for that specific unit)
3. Store the passive's cooldown with custom value or a hashtable, then create a periodic trigger to check the remaining cooldown and add back the hidden ability when it hits 0.

There are probably a lot of ways to do this.

Edit: corrected an oversight
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,024
Y'all forgot we have a tutorial section with answers to this written up real nice-like.

Use this one for attack-based effects: Passive ability with a cooldown (attack-based). You can make it cast something like a 0.01 second duration unholy frenzy, then detect casts of that spell with a trigger and do effects like deal bonus damage, attack again, spawn a unit, etc. whenever the spell is cast.

Note that a single unit may not have multiple orb effects on its attacks at any given time. I believe the only one that stacks is Black Arrow and I could be wrong about that.

Use this one for other passives with cooldowns: Passive ability with cooldown - Best method!
 
Status
Not open for further replies.
Top