- Joined
- Jul 30, 2012
- Messages
- 156
SilenceEx - Complete guide about Silence
This is not the silence you're looking for.Introduction |
This is a complete guide about Silence - the mechanic that disables a unit's abilities. Not just the ordinary Silence that we all know about, but all forms of Silence present in the game, and how they work internally. |
General Information |
Just like everything in the game, Silence is handled internally with counters. Every ability object has two counters for that: the Silence counter, and the Hide counter. These two things are handled by the same functions in game.dll:
JASS:
The Hide boolean determines if the ability will not only be silenced but also hidden from the command card. If it's true, the integer Count will also be added or subtracted from the Hide counter of the ability. If, at any moment in the game, the Silence counter of an ability is greater than zero, that ability is silenced. And if the Hide counter is greater than zero, the icon will be hidden from the command card. What are the effects of Silence?
What abilities can be silenced? - Almost everything can be silenced, active abilities, passives, even Move and Attack can be silenced/hidden. There's a small number of abilities that can never be silenced, CAbility: What happens if an ability is hidden? - If an ability is both silenced and hidden there is no difference. But there are things in the game that will hide an ability without silencing it (those things will be discussed later). If an ability is hidden but not silenced:
|
Regular Silence | |
This is the normal Silence that we all know about. It's used only by 4 abilities in the game: Silence, Drunken Haze, Soul Burn and Cloud. All of these abilities stack with each other, but multiple instances of the same ability do not stack. Regular Silence is handled by the following function:
JASS:
The Silence function will then call CAbility: This function will never hide the abilities, only silence them. |
SilenceEx - The special Silence |
JASS:
It doesn't check any condition: actives, passives, Move, Attack and everything else will be disabled. The only exception is the Physical argument, if it's true, it will silence only "Physical" abilities. (This is used by the Ethereal state to prevent you from attacking and doing things like building a structure) SilenceEx will call CAbility::Enable/Disable, passing the Hide boolean to them, then it will increase/decrease the Silence counter of the unit by 1, and will do the same to the Hide counter if Hide is true. This way, every new ability will be automatically silenced/hidden. However, many spells that make use of this function will explictly set exceptions to it: they do this by directly calling CAbility::Enable before the silence. This makes the Silence counter of that ability drop to -1, after calling SilenceEx, the counter will go back to 0, and the ability will not be silenced. Examples of abilities that use this trick:
|
Tips and Tricks |
Detecting SilenceThere are 3 very special abilities in Warcraft. Their names are Defend, Magic Defense and Immolation. These abilities are known as detector abilities because they can be used to detect a variety of events. What happens is that they fire an order event whenever they are silenced, or removed from a unit. Considering that the game will always silence an ability before removing it, that explains why the order is issued twice on removal. The game will also apply SilenceEx to a unit when it dies. By having any of these abilities present in a unit all the time, we can detect when that unit gets silenced. Defend and Magic Defense can only detect SilenceEx, while Immolation can detect regular Silence as well. Manipulating the Silence condition.The Silence function is called when a debuff is applied, and again when that buff is removed. If some ability is eligible for Silence when it is applied, but not eligible when it gets removed, that ability will be silenced forever. Likewise, if it was not eligible when silenced, and eligible when unsilenced, the Silence counter of that ability will drop to -1, making it immune to all sources of silence. The condition for many abilities to be silence-immune is to have only 1 level and 0 manacost. We can manipulate this condition in two ways:
|
Conclusion |
This guide presented a detailed description of how the Silence mechanism works internally, as well as some tricks that take advantage of that behaviour. This guide is NOT FINISHED YET, there are still a lot of hacks and tricks about Silence that soon I'll be writing about, together with some code snippets and a test map. If you have any suggestions or doubts about the contents feel free to post them here. |