I wanted to review a very old thread which was posted almost one year ago but still isn't completely well documented anywhere:
"Target" is one bitch of a key.
And yet, it's arguably the most important KV to understand, as its found in almost every datadriven Action.
Having a wrong
"Target" block is the number one reason of having to relaunch the game, testing with many combinations until you finally get the right context.
Quoting the wiki on this:
Note: These names mean different things in different events. It may require some experimentation to discover exactly what in each case.
This thread intends to compile every Target-related decision.
To test everything and get results, I used some simple scrips to test which parameters are seen in each event context. The KV and Lua Scripts are found in the second post, which also contains all the debug data.
After running many tests with different ability behaviors, here's what I got:
|OnSpellStart||CASTER, UNIT, ATTACKER|
|OnAbilityPhaseStart||CASTER, UNIT, ATTACKER|
This behavior adds TARGET as a possible value for the Target key:
|OnSpellStart||CASTER, TARGET, UNIT, ATTACKER|
|OnAbilityPhaseStart||CASTER, TARGET, UNIT, ATTACKER|
DOTA_ABILITY_BEHAVIOR_CHANNELLED only purpose is to change the ability Tooltip to "Channeled". In fact, the
BEHAVIOR_CHANNELED isn't even needed,
"AbilityChannelTime" is all that matters for the actual ability behavior.
|OnChannelFinish||CASTER, TARGET, UNIT, ATTACKER|
|OnChannelInterrupted||CASTER, TARGET, UNIT, ATTACKER|
|OnChannelSucceeded||CASTER, TARGET, UNIT, ATTACKER|
|OnProjectileFinish||CASTER, TARGET, PROJECTILE|
|OnProjectileHitUnit||CASTER, TARGET, PROJECTILE|
Target always refers to the owner of the modifier.
In these events we can send an extra parameter, referenced as %attack_damage
Note that this is not a value taken from an AbilitySpecial, instead it is generated by the system to be used in very particular events.
|OnTakeDamage||CASTER, UNIT, ATTACKER||post reduction|
|OnDealDamage||CASTER, UNIT, ATTACKER||post reduction|
In some of the attack events we can also use the %attack_damage
|OnAttack||CASTER, TARGET, ATTACKER||0|
|OnAttackStart||CASTER, TARGET, ATTACKER||0|
|OnAttackAllied||CASTER, TARGET, ATTACKER||0|
|OnAttacked||CASTER, TARGET, ATTACKER||post reduction|
|OnAttackLanded||CASTER, TARGET, ATTACKER||before reduction, the real attack value|
|OnAttackFailed||CASTER, TARGET, ATTACKER||before reduction, the real attack value|
|OnDeath||CASTER, UNIT, ATTACKER|
|OnKill||CASTER, UNIT, ATTACKER|
|OnHeroKilled||CASTER, TARGET, ATTACKER|
|OnAbilityEndChannel||CASTER, UNIT||TARGET if the ability isn't NO_TARGET|
|OnAbilityExecuted||CASTER, UNIT||TARGET if the ability isn't NO_TARGET|
|OnOrder||CASTER, UNIT||TARGET if the Order is an ability with target|
|OnRespawn||CASTER, UNIT||needs "Attributes" "PERMANENT" on its modifier|
OnAbilityStart - Broken?
Please report if you find any inconsistencies.
On the next post you'll find the random rambling analyzed to get the results.
Then we'll move to Multiple Targets, acting over different entities, Flags, etc.