Dota 2 Workshop Tools/Scripting/API/Global.ApplyDamage: Difference between revisions
< Dota 2 Workshop Tools | Scripting | API
Jump to navigation
Jump to search
RoyAwesome (talk | contribs) (Dota_Lebot push: Updated Page) |
RoyAwesome (talk | contribs) (Dota_Lebot push: Updated Page) |
||
Line 8: | Line 8: | ||
''' float ApplyDamage(handle ''DamageTable'') ''' | ''' float ApplyDamage(handle ''DamageTable'') ''' | ||
'' | ''Applies damage to a unit. | ||
Table Inputs: victim, attacker, damage, damage_type, damage_flags, ability'' | |||
Revision as of 16:17, 12 August 2014

Function Description
float ApplyDamage(handle DamageTable)
Applies damage to a unit.
Table Inputs: victim, attacker, damage, damage_type, damage_flags, ability
- Example
--Apply 500 pure damage from player 1's hero to itself
playerHero = PlayerResource:GetPlayer(1):GetAssignedHero()
local damageTable = {
victim = playerHero,
attacker = playerHero,
damage = 500,
damage_type = DAMAGE_TYPE_PURE,
}
ApplyDamage(damageTable)
Parameters
Type | Name | Description |
---|---|---|
handle | DamageTable | a table containing Unit Victim, Unit attacker, float damage, and DAMAGE_TYPE type |
Returns
float - damage done after reductions