- Joined
- Jul 30, 2012
- Messages
- 156
Passive ability with cooldown - the easy way!
The hardest part of this tutorial is formatting it properlyIntroduction |
First of all, this tutorial is not a copy of [thread=211589]this[/thread]. This tutorial presents a new way to make passives with cooldown. This is not attack-based, instead it gives you a passive ability with a cooldown that you can trigger any time you want. I've known this trick for a very long time, and I guess it's more than time to make it public, as I couldn't find it anywhere else. |
Exhume Corpses - the magic passive |
![]() The Exhume Corpses ability is the only passive ability with cooldown in the entire game! I believe this has not been found before, because this ability does not have a cooldown by default. But in fact, it's just like any other spell: it can have a cooldown, a manacost, and it fires spell casting events whenever it's cast. The only difference is that it displays a button that cannot be clicked. So how can we cast it? We don't need to do that, the Exhume Corpses ability automatically casts itself whenever possible! |
Configuring Exhume Corpses |
You can just make your custom ability based on Exhume Corpses and modify it as you like: you can change icons, tooltips, set a cooldown, and have multiple levels if you want. Now the important thing is to set the Duration - Normal field to 0.01. This field determines how often the Exhume Corpses ability will check if it can be cast. Setting it to 0 would also work, but it causes the game to freeze some times (like if the unit is stunned), so the minimum safe value is 0.01.The "Unit Type" and "Maximum Corpses" data fields can be ignored, we're not going to use them. |
Triggering the cooldown |
Exhume Corpses requires the Cargo Hold (Meat Wagon) ability ('Sch2') to be present on the unit. If this ability is not present, Exhume Corpses cannot be cast. Therefore, all you need to do is:
After that, the Exhume Corpses ability will magically cast itself at every cooldown. But as you may know, Exhume Corpses creates a corpse with every cast. We need to remove this side effect, as we don't want the game to create a unit for no reason. Fortunately that's very easy to achieve. To prevent the creation of the corpse we just need to disable the Cargo Hold ability. The easiest way to do that is with a requirement, just go to the Cargo Hold ability, select the Techtree - Requirements field, press Shift+Enter and type an invalid id:
Alternatively you can disable it directly with triggers:
|
Triggering the effects |
With everything ready, you can use your passive ability just like any other spell:
Notice that when you add Cargo Hold to the unit, the ability will not be cast immediately, but only after a 0-second delay. So you should wait for the spell to finish if you want to remove Cargo Hold after that. |
Tips and Tricks | |||
Having multiple passives on the same unitIn normal ocasions, a unit can't have more than one custom ability with the same ability as base. But since Exhume Corpses is the only passive with cooldown, this is not an option if you want a unit to have multiple of it. The only solution is, whenever you want to make one of those abilities go on cooldown, you temporarily disable all the others:
And then you make a trigger to re-enable all abilities after casting any of them:
Using Exhume Corpses with itemsThe Exhume Corpses ability can also be used with items. With this you can create a passive item that displays a cooldown, similar to the "Amulet of Spell Shield". However, Exhume Corpses doesn't work if you put it directly on the item. So instead, you must put it in a Spellbook, and then put this spellbook on the item: Forcing the ability to cast immediatelyWhen you add the Cargo Hold ability to a unit, your passive ability will not be cast immediately, but only after a small delay. This is the delay that you put in the Duration - Normal field, you can't set it to 0, and even if you did, it still wouldn't be instant.But if for some reason you really need to bypass this delay and cast your ability instantly, you can simply give the order directly:
The order id for Exhume Corpses is 852537. When you issue this order, if Cargo Hold present on the unit, Exhume Corpses will be cast immediately, ignoring the delay. However this has the downside that it interruputs the current orders of the unit, so I do not recommend using this method unless you really know what you're doing. |
Conclusion |
I have attached a Test Map demostrating the passive with cooldown. In this example it creates a Clockwerk Goblin every 5 seconds, while displaying a cooldown indicator to the user. If you have any questions or suggestions, please let me know. And I'm sorry for being too lazy to write this guide before, I have really found this trick a long time ago. |
Changelog |
02-04-2016 -Added information about using Exhume Corpses with items -Added information about having multiple passives on a unit -Added information about making the ability cast immediately -Changed minimum delay of the ability to 0.01 to prevent game freeze 01-27-2016 -Initial release |
Attachments
Last edited: