🎭NPC
Table to work with CNPC
.
CNPC
.CNPC
extends CEntity
npc
npc to get owner from
Returns owner of the CNPC
. Works for spirit bear.
npc
npc to get item from
name
string
name of the item
isReal [?]
boolean
if true, returns only 1-6 slots and neutral item, otherwise returns all items (including backpack and stash) (default: true)
Returns CItem
by name.
npc
npc to check
name
string
name of the item
isReal [?]
boolean
if true, returns only 1-6 slots and neutral item, otherwise returns all items (including backpack and stash) (default: true)
Returns true
if the CNPC
has item with specified name.
npc
npc to check
name
string
name of the modifier
Returns true
if the CNPC
has modifier with specified name.
npc
npc to get modifier from
name
string
name of the modifier
Returns CModifier
by name.
`poperty_filter` doesn`t filter all modifiers every call, it uses already prefiltered list.
npc
npc to get modifiers from
poperty_filter [?]
Filter modifiers by specified property (default: Enum.ModifierFunction.MODIFIER_FUNCTION_INVALID)
Returns an array of all NPC's CModifier
s.
npc
npc to check
isReal [?]
boolean
if true, returns only 1-6 slots and neutral item, otherwise returns all items (including backpack and stash) (default: true)
Returns true
if the CNPC
has free inventory slot.
npc
npc to check
state
state to check
Returns true
if the CNPC
has state. The best way to check if the CNPC
is stunned, silenced, hexed, has BKB immune etc.
IsWaitingToSpawn(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if waiting to spawn. For example, creeps are waiting to spawn under the ground near the barracks.
IsIllusion(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is illusion.
IsVisible(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is visible to local player.
IsVisibleToEnemies(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is visible enemies.
IsCourier(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a courier.
IsRanged(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a ranged unit.
IsCreep(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a creep.
IsLaneCreep(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a lane creep.
IsStructure(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a structure.
IsTower(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a tower.
GetUnitType(npc: CNPC
): Enum.UnitTypeFlags
CNPC
): Enum.UnitTypeFlags
npc
npc to check
Returns unit type flags.
IsConsideredHero(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if it is unit a considered a hero for targeting purposes.
IsBarracks(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a barracks.
IsAncient(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is an ancient creeps.
IsRoshan(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a Roshan.
IsNeutral(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a neutral. Neutral creeps, ancient creeps.
IsHero(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a hero.
IsWard(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a ward.
IsMeepoClone(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is a meepo clone.
npc
npc to check
npc2
npc to check
range
number
range to check
Returns true
if the CNPC
in range of other CNPC
.
npc
npc to check
pos
position to check
range
number
range to check
hull [?]
number
hull just added to range (default: 0.0)
Returns true
if the CNPC
in range of position.
IsLinkensProtected(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is protected by Linkens Sphere.
IsMirrorProtected(npc: CNPC
): boolean
CNPC
): boolean
npc
npc to check
Returns true
if the CNPC
is protected by Mirror Shield.
IsChannellingAbility(npc: CNPC
): boolean
CNPC
): boolean
Do not work for items.
npc
npc to check
Returns true
if the CNPC
is channeling ability. Black Hole, Life Drain, etc.
npc
target npc
Returns the currently channelling CAbility
.
IsRunning(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
is running.
IsAttacking(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
is attacking.
IsSilenced(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
is silenced.
IsStunned(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
is stunned.
HasAegis(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
has aegis.
IsKillable(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true
if the CNPC
has killable. Example: false if affected by Eul.
GetActivity(npc: CNPC
): Enum.GameActivity
CNPC
): Enum.GameActivity
npc
target npc
Returns the CNPC
activity, such as running, attacking, casting, etc.
GetAnimationInfo(npc: CNPC
): {sequence:integer, cycle:number, name:string, mdl_name:string}
CNPC
): {sequence:integer, cycle:number, name:string, mdl_name:string}
npc
target npc
Returns information about the current animation of the CNPC
.
GetAttackRange(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the base attack range of the CNPC
.
GetAttackRangeBonus(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the bonus attack range of the CNPC
.
GetCastRangeBonus(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the bonus cast range of the CNPC
.
npc
target npc
excludeWhiteArmor [?]
boolean
exclude white armor (default: true)
Returns the physical armor value of the CNPC
.
GetPhysicalDamageReduction(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the physical damage reduction value of the CNPC
.
GetArmorDamageMultiplier(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the physical damage multiplier value of the CNPC
.
GetMagicalArmorValue(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the magical armor value of the CNPC
.
GetMagicalArmorDamageMultiplier(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the magical damage multiplier value of the CNPC
.
npc
target npc
ignore_temp_attack_speed [?]
boolean
ignore temporary attack speed (default: false)
Returns increased attack speed of the CNPC
.
npc
target npc
ignore_temp_attack_speed [?]
boolean
ignore temporary attack speed (default: false)
Returns the number of attacks per second that the CNPC
can deal.
GetAttackTime(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the amount of time needed for the CNPC
to perform an attack.
npc
target npc
ignore_temp_attack_speed [?]
boolean
ignore temporary attack speed (default: false)
Returns the attack speed of the CNPC
.
GetBaseAttackSpeed(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the base attack speed of the CNPC
.
GetHullRadius(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the model interaction radius of the CNPC
.
GetPaddedCollisionRadius(npc: NPC
): number
NPC
): number
npc
NPC
target npc
Returns the collision hull radius (including padding) of this NPC
.
GetProjectileCollisionSize(npc: CNPC
): number
CNPC
): number
see: https://dota2.fandom.com/wiki/Unit_Size#Collision_Size
npc
target npc
Returns the collision size of the CNPC
. Collision size is the internal size that prevents other units from passing through.
GetTurnRate(npc: CNPC
): number
CNPC
): number
see: https://dota2.fandom.com/wiki/Turn_rate
npc
target npc
Returns the turn rate, which is the speed at which the CNPC
can turn.
GetAttackAnimPoint(npc: CNPC
): number
CNPC
): number
see: https://dota2.fandom.com/wiki/Attack_animation
npc
target npc
Returns the attack animation point, nil
if not found.
GetAttackProjectileSpeed(npc: CNPC
): integer
CNPC
): integer
see: https://dota2.fandom.com/wiki/Projectile_Speed
npc
target npc
Returns the attack projectile speed, nil
if not found.
IsTurning(npc: CNPC
): boolean
CNPC
): boolean
npc
target npc
Returns true if the CNPC
is turning.
GetAngleDiff(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the remaining degree angle needed to complete the turn of the CNPC
.
GetPhysicalArmorMainValue(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the (main) white armor of the CNPC
.
npc
source npc
npc
target npc
Returns the amount of time needed for the source CNPC
to face the target CNPC
.
npc
source npc
pos
position to find the rotation angle
Returns the rotation angle of the CNPC
.
npc
source npc
pos
target position
Returns the amount of time needed for the source CNPC
to face a specific position.
FindFacingNPC(npc: CNPC
, ignoreNpc: CNPC
, team_type [?]
: Enum.TeamType
, angle [?]
: number
, distance [?]
: number
): CNPC
|nil
CNPC
, ignoreNpc: CNPC
, team_type [?]
: Enum.TeamType
, angle [?]
: number
, distance [?]
: number
): CNPC
|nil
npc
source npc
ignoreNpc
ignore npc
team_type [?]
team type (default: TEAM_BOTH)
angle [?]
number
max angle to check (default: 0.0)
distance [?]
number
max distance to check (default: 0.0)
Returns the CNPC
that the source CNPC
is currently facing.
GetBaseSpeed(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the base move speed of the CNPC
.
GetMoveSpeed(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the move speed of the CNPC
.
GetMinDamage(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the minumum attack damage of the CNPC
.
GetBonusDamage(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the bonus attack damage of the CNPC
.
GetTrueDamage(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the minumum attack damage + bonus damage of the CNPC
.
GetTrueMaximumDamage(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the maximum attack damage + bonus damage of the CNPC
.
npc
target npc
index
integer
item index
Returns the CItem
by index.
npc
target npc
index
integer
ability index
Returns the CAbility
by index.
npc
npc to get ability from
activity
game activity
Returns the CAbility
by game activity.
npc
target npc
name
string
ability name
Returns the CAbility
by name.
npc
target npc
name
string
ability name
Returns true
if the CNPC
has this ability.
GetMana(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the current mana of the CNPC
.
GetMaxMana(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the maximum mana of the CNPC
.
GetManaRegen(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the mana regeneration rate of the CNPC
.
GetHealthRegen(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the health regeneration rate of the CNPC
.
GetCurrentLevel(npc: CNPC
): number
CNPC
): number
npc
target npc
Returns the current level of the CNPC
.
GetDayTimeVisionRange(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the day-time vision range of the CNPC
.
GetNightTimeVisionRange(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the night-time vision range of the CNPC
.
GetUnitName(npc: CNPC
): string
CNPC
): string
npc
target npc
Returns the unit-name of the CNPC
.
npc
target npc
checkOverride [?]
bool
returns override offset if it exists (default: true)
Returns the health bar offset of the CNPC
.
GetUnitNameIndex(npc: CNPC
): integer
CNPC
): integer
index can change when new unit are added
npc
target npc
Returns unit-name index of the CNPC
.
npc
target npc
name
string
attachment name. e.g. "attach_hitloc"
Returns the attachment position of the CNPC
by the name.
Example
npc
target npc
index
integer
attachment index
Returns the attachment position of the CNPC
by the specified index.
npc
target npc
name
string
attachment name. e.g. "attach_hitloc"
Returns the attachment index of the CNPC
by the name.
GetBountyXP(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the amount of experience points (XP) you can earn for killing the CNPC
.
GetGoldBountyMin(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the minimum amount gold you can earn for killing the CNPC
.
GetGoldBountyMax(npc: CNPC
): integer
CNPC
): integer
npc
target npc
Returns the maximum amount gold you can earn for killing the CNPC
.
npc
The target NPC.
position
The destination position.
queue [?]
boolean
Add the order to the Dota queue. (default: false)
show [?]
boolean
Show the order position. (default: false)
callback [?]
boolean
Push the order to the OnPrepareUnitOrders callback. (default: false)
executeFast [?]
boolean
Place the order at the top of the queue. (default: false)
identifier [?]
string
The identifier which will be passed to OnPrepareUnitOrders
callback. (default: nil)
Initiates an order for the CNPC
to move to a specified position.
npc
The target NPC.
z
number
Z pos
Sets the Z position of the CNPC
model.
HasScepter(npc: CNPC
): boolean
CNPC
): boolean
npc
The target NPC.
Returns true
if the CNPC
has or consumed Aghanim Scepter.
HasShard(npc: CNPC
): boolean
CNPC
): boolean
npc
The target NPC.
Returns true
if the CNPC
has or consumed Aghanim Shard.
npc
The target NPC.
sequence
integer
The sequence index.
Returns sequence duration of the npc with the specified sequence index.
npc
The target NPC.
bIgnoreTempAttackSpeed
boolean
Ignore temporary attack speed.
Returns the seconds per attack of the npc.
GetBarriers(npc: CNPC
): {physical:{total:number, current:number}, magic:{total:number, current:number}, all:{total:number, current:number}}
CNPC
): {physical:{total:number, current:number}, magic:{total:number, current:number}, all:{total:number, current:number}}
npc
The target NPC.
Returns a table with information about the barriers of the CNPC
.
GetGlow(npc: CNPC
): {m_bSuppressGlow:boolean, m_bFlashing:boolean, m_bGlowing:boolean, m_iGlowType:integer, r:integer, g:integer, b:integer}
CNPC
): {m_bSuppressGlow:boolean, m_bFlashing:boolean, m_bGlowing:boolean, m_iGlowType:integer, r:integer, g:integer, b:integer}
npc
The target NPC.
Returns a table with information about the current glow effect of the CNPC
.
SetGlow(npc: CNPC
, suppress_glow: boolean
, flashing: boolean
, glowing: boolean
, glow_type: integer
, r: integer
, g: integer
, b: integer
): nil
CNPC
, suppress_glow: boolean
, flashing: boolean
, glowing: boolean
, glow_type: integer
, r: integer
, g: integer
, b: integer
): nil
npc
The target NPC.
suppress_glow
boolean
suppress_glow
flashing
boolean
flashing
glowing
boolean
glowing
glow_type
integer
glow type
r
integer
r factor
g
integer
g factor
b
integer
b factor
Sets the CNPC
glow effect.
npc
The target NPC.
r
integer
r factor
g
integer
g factor
b
integer
b factor
Sets the CNPC
model color.
npc
The target NPC.
npc
The target NPC.
Checks if the CNPC
is in range of a shop.
GetBaseSpellAmp(npc: CNPC
): number
CNPC
): number
npc
The target NPC.
Returns the base spell amplification of the CNPC
.
npc
The target NPC.
property
Property enum.
Returns the property value for the CNPC
.
npc
npc to check
playerId
integer
player id
Returns true
if npc is controllable by player.
Fixes the issue when you have multiple Kaya items that actually don't stack.
npc
The target NPC.
property
Property enum.
Returns the hieghest property value for the CNPC
.
Last updated