Unit AI API - ModDota/Dota2AIFramework GitHub Wiki
#Unit AI Functions These functions are available on every unit handle the AI can access.
Table of contents
- entity:GetClassname
- entity:GetEntityHandle
- entity:GetEntityIndex
- entity:GetName
- unit:FindAbilityByName
- unit:GetAbilityByIndex
- unit:GetAbilityPoints
- unit:GetAbsOrigin
- unit:GetAttackAnimationPoint
- unit:GetAttackCapability
- unit:GetAttackRange
- unit:GetAttackRange
- unit:GetAttackSpeed
- unit:GetAttacksPerSecond
- unit:GetAverageTrueDamage
- unit:GetForwardVector
- unit:GetGold
- unit:GetHealth
- unit:GetIdealSpeed
- unit:GetItemInSlot
- unit:GetLevel
- unit:GetMaxHealth
- unit:GetModelName
- unit:GetOrigin
- unit:GetOwner
- unit:GetOwnerEntity
- unit:GetPlayerOwnerID
- unit:GetProjectileSpeed
- unit:GetTeam
- unit:GetTeamNumber
- unit:HasBuyback
- unit:IsAlive
- unit:IsHero
- unit:IsInVision
- unit:IsTower
Function List
entity:GetClassname()
Description
Get the classname of the entity.
Modification
-
entity:GetEntityHandle()
Description
Get the entity handle of the entity.
Modification
-
entity:GetEntityIndex()
Description
Get the entity index of the entity.
Modification
-
entity:GetName()
Description
Get the name of the entity.
Modification
-
unit:FindAbilityByName(name)
Description
Retrieve an ability by index from the unit.
Parameters
- name - The name of the ability to look up.
Modification
Only works if the unit is in vision and wraps result.
unit:GetAbilityByIndex(index)
Description
Retrieve an ability by index from the unit.
Parameters
- index - The index of the ability on the unit.
Modification
Wrap the result, only works if unit is in vision, nil otherwise.
unit:GetAbilityPoints()
Description
Retrieve the amount of ability points a hero has.
Modification
Only works for allies.
unit:GetAbsOrigin()
Description
Get the position of the unit.
Modification
Return nil when unit is in fog of war.
unit:GetAttackAnimationPoint()
Description
Get the unit's attack animation point.
Modification
Only works in vision.
unit:GetAttackCapability()
Description
Get the unit's attack capability.
Modification
Only works in vision.
unit:GetAttackRange()
Description
Get the unit's attack range.
Modification
Only works in vision.
unit:GetAttackRange()
Description
Get the unit's attack range.
Modification
Only works in vision.
unit:GetAttackSpeed()
Description
Get the unit's attack speed.
Modification
Only works in vision.
unit:GetAttacksPerSecond()
Description
Get the amount of attacks the unit does per second based on its attack speed.
Modification
Only works in vision.
unit:GetAverageTrueDamage()
Description
Get the average value of the unit's minimum and maximum damage values.
Modification
Only works in vision.
unit:GetForwardVector()
Description
Get the forward vector of the unit.
Modification
Only works in vision.
unit:GetGold()
Description
Get the gold of a unit.
Modification
Modification: Only works for allies.
unit:GetHealth()
Description
Get the health of the unit.
Modification
Return nil when unit is in fog of war.
unit:GetIdealSpeed()
Description
Get the unit's movespeed.
Modification
Only works in vision.
unit:GetItemInSlot(slot)
Description
Retrieve an item by slot from the unit.
Parameters
- slot - The name of the ability to look up.
Modification
Only works if the unit is in vision and wraps the result.
unit:GetLevel()
Description
Get the level of a unit.
Modification
Modification: Only works for units in vision.
unit:GetMaxHealth()
Description
Get the maximum health of the unit.
Modification
Return nil when unit is in fog of war.
unit:GetModelName()
Description
Get the model name of the unit.
Modification
Return nil when unit is in fog of war.
unit:GetOrigin()
Description
Get the position of the unit.
Modification
Return nil when unit is in fog of war.
unit:GetOwner()
Description
Get the owner of the unit.
Modification
Wrap result.
unit:GetOwnerEntity()
Description
Get the owner of the unit.
Modification
Wrap result.
unit:GetPlayerOwnerID()
Description
Get the ID of the player owning this unit.
Modification
-
unit:GetProjectileSpeed()
Description
Get the unit's projectile speed.
Modification
Only works in vision.
unit:GetTeam()
Description
Get the team of the unit.
Modification
-
unit:GetTeamNumber()
Description
Get the team of the unit.
Modification
None.
unit:HasBuyback()
Description
Return if the unit has buyback or not. Only for allies.
Modification
Does not exist in regular API.
unit:IsAlive()
Description
Return if the unit is alive or not.
Modification
-
unit:IsHero()
Description
See if the hero is a unit or not.
Modification
Only works in vision.
unit:IsInVision()
Description
Return if the unit is in vision or not
Modification
Does not exist in regular API.
unit:IsTower()
Description
See if the hero is a unit or not.
Modification
Only works in vision.