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) (Created page with "Return damage done. ;Example <source lang="lua"> local damageTable = { victim = player.playerHero, attacker = player.playerHero, damage = m_damageAmount, damage_type = DAMAG...") |
Thunder4ik (talk | contribs) m (clean up, added deadend tag) |
||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Dead end|date=January 2024}} | |||
{{Note | This page is automatically generated. Any changes may be overwritten}} | |||
== Function Description == | |||
''' float ApplyDamage(handle ''DamageTable'') ''' | |||
''Applies damage to a unit. | |||
Table Inputs: victim, attacker, damage, damage_type, damage_flags, ability'' | |||
;Example | ;Example | ||
<source lang="lua"> | <source lang="lua"> | ||
--Apply 500 pure damage from player 1's hero to itself | |||
playerHero = PlayerResource:GetPlayer(1):GetAssignedHero() | |||
local damageTable = { | local damageTable = { | ||
victim = | victim = playerHero, | ||
attacker = | attacker = playerHero, | ||
damage = | damage = 500, | ||
damage_type = DAMAGE_TYPE_PURE, | damage_type = DAMAGE_TYPE_PURE, | ||
damage_flags = DOTA_DAMAGE_FLAG_NONE, --Optional. | |||
ability = playerHero:GetAbilityByIndex(0), --Optional. | |||
} | } | ||
ApplyDamage(damageTable) | |||
</source> | |||
== Parameters == | |||
{| class="standard-table" style="width: 50%;" | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| handle | |||
| DamageTable | |||
| a table containing Unit Victim, Unit attacker, float damage, and DAMAGE_TYPE type | |||
|} | |||
== Returns == | |||
''float'' - damage done after reductions | |||
[[Category:Dota2Function]] | |||
[[Category:Global]] |
Latest revision as of 09:54, 21 January 2024

This article has no
links to other VDC articles. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024


January 2024

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,
damage_flags = DOTA_DAMAGE_FLAG_NONE, --Optional.
ability = playerHero:GetAbilityByIndex(0), --Optional.
}
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