Skip to content

NPC

The NPC class extends ModelEntity with combat, movement, inventory, and unit state APIs.

NOTE

This page documents members declared directly on NPC. Inherited members are available from ModelEntity.


Methods

GetMaxPhysicBarrier()number

Retrieves the maximum physical barrier.

Returned:

  • number - The requested maximum physical barrier.

GetMaxMagicBarrier()number

Retrieves the maximum magic barrier.

Returned:

  • number - The requested maximum magic barrier.

GetMaxAllBarrier()number

Retrieves the maximum all barrier.

Returned:

  • number - The requested maximum all barrier.

GetPhysicBarrier()number

Retrieves the physical barrier.

Returned:

  • number - The requested physical barrier.

GetMagicBarrier()number

Retrieves the magic barrier.

Returned:

  • number - The requested magic barrier.

GetAllBarrier()number

Retrieves the all barrier.

Returned:

  • number - The requested all barrier.

GetStartSequenceCycle()number

Retrieves the start sequence cycle.

Returned:

  • number - The requested start sequence cycle.

GetKeyValues()KeyValue | null

Retrieves the key values.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

FindKey(key: string)KeyValue | null

Finds the key.

  • keystring - The key.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetProjectileSpeed()number

Retrieves the projectile speed.

Returned:

  • number - The requested projectile speed.

SetHasColorGem(val: boolean)void

Enables or disables the color gem state.

  • valboolean - The value to apply.

HasColorGem()boolean

Checks whether the unit currently has a color gem.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetGemColor(color: Color)void

Sets the gem color.

  • colorColor - The color value to use.

GetGemColor()Color

Retrieves the gem color.

Returned:

  • Color - The result of the call.

GetGoldBountyMin()number

Retrieves the minimum gold bounty.

Returned:

  • number - The requested gold bounty minimum.

GetGoldBountyMax()number

Retrieves the maximum gold bounty.

Returned:

  • number - The requested gold bounty maximum.

IsControllableByPlayer(player: Player)boolean

Checks whether the unit is controllable by the specified player.

  • playerPlayer - The player entity.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsInRangeOfShop(shopType: Enum.ShopType)boolean

Checks whether the unit is within range of the specified shop.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetTurnAngleDiff()number

Retrieves the turn angle difference.

Returned:

  • number - The requested turn angle difference.

GetUnitState()bigint

Retrieves the unit state.

Returned:

  • bigint - The requested unit state.

SetUnitState(state: bigint | number)void

Sets the unit state.

  • statebigint | number - The state value.

HasState(state: Enum.ModifierState)boolean

Checks whether it has state.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetAttackRange()number

Retrieves the attack range.

Returned:

  • number - The requested attack range.

GetAttackRangeWithBonus()number

Retrieves the attack range with bonus.

Returned:

  • number - The requested attack range with bonus.

GetAttackRangeBonus()number

Retrieves the attack range bonus.

Returned:

  • number - The requested attack range bonus.

GetCastRangeBonus()number

Retrieves the cast range bonus.

Returned:

  • number - The requested cast range bonus.

GetCombatClassDefend()number

Retrieves the combat class defend.

Returned:

  • number - The requested combat class defend.

GetCombatClassAttack()number

Retrieves the combat class attack.

Returned:

  • number - The requested combat class attack.

GetDamageMultiplierVersus(entity: NPC)number

Retrieves the damage multiplier against the specified unit.

  • entityNPC - The entity to use.

Returned:

  • number - The requested damage multiplier versus.

GetPhysicalArmorValue()number

Retrieves the physical armor value.

Returned:

  • number - The requested physical armor value.

GetPhysicalDamageReduction()number

Retrieves the physical damage reduction.

Returned:

  • number - The requested physical damage reduction.

GetArmorDamageMultiplier()number

Retrieves the armor damage multiplier.

Returned:

  • number - The requested armor damage multiplier.

GetMagicalArmorValue()number

Retrieves the magical armor value.

Returned:

  • number - The requested magical armor value.

GetMagicalArmorDamageMultiplier()number

Retrieves the magical armor damage multiplier.

Returned:

  • number - The requested magical armor damage multiplier.

GetIncreasedAttackSpeed()number

Returns base attack speed + attack speed bonus

Returned:

  • number - The requested increased attack speed.

GetBaseAttackSpeed()number

Retrieves the base attack speed.

Returned:

  • number - The requested base attack speed.

GetAttackSpeedBonus()number

Retrieves the attack speed bonus.

Returned:

  • number - The requested attack speed bonus.

GetAttackTime()number

Retrieves the attack time.

Returned:

  • number - The requested attack time.

GetAttacksPerSecond()number

Retrieves the attacks per second.

Returned:

  • number - The requested attacks per second.

GetHullRadius()number

Retrieves the hull radius.

Returned:

  • number - The requested hull radius.

GetProjectileCollisionSize()number

Retrieves the projectile collision size.

Returned:

  • number - The requested projectile collision size.

GetTurnRate()number

Retrieves the turn rate.

Returned:

  • number - The requested turn rate.

IsTurning()boolean

Checks whether it is turning.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsWaitingToSpawn()boolean

Checks whether it is waiting to spawn.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetTimeToFace(entity: Entity)number

Retrieves the time to face.

  • entityEntity - The entity to use.

Returned:

  • number - The requested time to face.

FindRotationAngle(position: Vector, useAngleDiff?: boolean)Angle

Finds the rotation angle.

  • positionVector - The position to use.
  • useAngleDiffboolean (optional) - Whether to use angle difference.

Returned:

  • Angle - The result of the call.

GetTimeToFacePosition(position: Vector)number

Retrieves the time to face position.

  • positionVector - The position to use.

Returned:

  • number - The requested time to face position.

FindFacingNPC(teamType: Enum.TeamType, minRange?: number, minAngle?: number, useAngleDiff?: boolean)NPC | null

Finds an NPC currently facing the unit.

  • teamTypeEnum.TeamType - The team selection filter.
  • minRangenumber (optional) - 1
  • minAnglenumber (optional) - 1
  • useAngleDiffboolean (optional) - Whether to use angle difference.

Returned:

  • NPC | null - The matching object, or null if it is not available.

GetMoveSpeed()number

Retrieves the move speed.

Returned:

  • number - The requested move speed.

GetBaseSpeed()number

Retrieves the base speed.

Returned:

  • number - The requested base speed.

IsMoving()boolean

Checks whether it is moving.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetMana()number

Retrieves the mana.

Returned:

  • number - The requested mana.

GetMaxMana()number

Retrieves the maximum mana.

Returned:

  • number - The requested maximum mana.

GetManaRegen()number

Retrieves the mana regen.

Returned:

  • number - The requested mana regen.

GetHealthRegen()number

Retrieves the health regen.

Returned:

  • number - The requested health regen.

GetBaseHealthRegen()number

Retrieves the base health regen.

Returned:

  • number - The requested base health regen.

GetBaseManaRegen()number

Retrieves the base mana regen.

Returned:

  • number - The requested base mana regen.

GetCurrentLevel()number

Retrieves the current level.

Returned:

  • number - The requested current level.

GetDayTimeVisionRange()number

Retrieves the day time vision range.

Returned:

  • number - The requested day time vision range.

GetNightTimeVisionRange()number

Retrieves the night time vision range.

Returned:

  • number - The requested night time vision range.

IsIllusion()boolean

Checks whether it is illusion.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetHealthBarOffset()number

Retrieves the health bar offset.

Returned:

  • number - The requested health bar offset.

GetUnitName()string

Retrieves the unit name.

Returned:

  • string - The requested unit name.

GetImage(needIcon?: boolean)Image

Retrieves the image.

  • needIconboolean (optional) - Whether to return the icon variant.

Returned:

  • Image - The result of the call.

GetFountainPosition()Vector

Retrieves the fountain position.

Returned:

  • Vector - The result of the call.

HasAghanimScepter()boolean

Checks whether it has aghanim scepter.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetAttackDelay()number

Retrieves the attack delay.

Returned:

  • number - The requested attack delay.

GetAttackAnimationPoint()number

Retrieves the attack animation point.

Returned:

  • number - The requested attack animation point.

GetAnimationSequence()number

Retrieves the animation sequence.

Returned:

  • number - The requested animation sequence.

GetAnimationCycle()number

Retrieves the animation cycle.

Returned:

  • number - The requested animation cycle.

SetZDelta(height: number)void

Sets the zdelta.

  • heightnumber - The height.

GetUltimate()Ability | null

Retrieves the ultimate.

Returned:

  • Ability | null - The matching object, or null if it is not available.

IsVisible()boolean

Checks whether it is visible.

Returned:

  • boolean - True if the condition is met, false otherwise.

HasTrueSight()boolean

Checks whether it has true sight.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetUnitType()number

Retrieves the unit type.

Returned:

  • number - The requested unit type.

SetUnitType(unitType: number)void

Sets the unit type.

  • unitTypenumber - The unit type value.

SetHealthBar(type: number)void

Sets the health bar.

  • typenumber - 2 - default, -1 - no health bar, 0 - creep, up to 17 - undocumented

GetAttackCapabilities()number

Retrieves the attack capabilities.

Returned:

  • number - The requested attack capabilities.

IsUnitType(unitType: Enum.UnitType)boolean

Checks whether it is unit type.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsRanged()boolean

Checks whether it is ranged.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsCreep()boolean

Checks whether it is creep.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsLaneCreep()boolean

Checks whether it is lane creep.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsRoshan()boolean

Checks whether it is roshan.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsNeutral()boolean

Checks whether it is neutral.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsStructure()boolean

Checks whether it is structure.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsTower()this is Tower

Checks whether it is tower.

Returned:

  • this is Tower - The result of the call.

IsAncient()boolean

Checks whether it is ancient.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsCourier()this is Courier

Checks whether it is courier.

Returned:

  • this is Courier - The result of the call.

IsShrine()boolean

Checks whether it is shrine.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsMeepoClone()boolean

Checks whether it is meepo clone.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsVisibleByEnemy()boolean

Checks whether it is visible by enemy.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetModifiers()Modifier[]

Retrieves the modifiers.

Returned:

  • Modifier[] - An array with the matching values.

GetModifier(modifierName: string)Modifier | null

Retrieves the modifier.

  • modifierNamestring - The modifier name.

Returned:

  • Modifier | null - The matching object, or null if it is not available.

HasModifier(modifierName: string)boolean

Checks whether it has modifier.

  • modifierNamestring - The modifier name.

Returned:

  • boolean - True if the condition is met, false otherwise.

HasInventorySlotFree(inRealInventory?: boolean)boolean

Checks whether it has inventory slot free.

  • inRealInventoryboolean (optional) - Whether to use only the real inventory.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetItems(inRealInventory?: boolean)Item[]

Retrieves the items.

  • inRealInventoryboolean (optional) - Whether to use only the real inventory.

Returned:

  • Item[] - An array with the matching values.

GetItemByIndex(index: number)Item | null

Retrieves the item by index.

  • indexnumber - The index value.

Returned:

  • Item | null - The matching object, or null if it is not available.

GetItem(itemName: string, realInventory?: boolean)Item | null

Retrieves the item.

  • itemNamestring - The item name.
  • realInventoryboolean (optional) - Whether to use only the real inventory.

Returned:

  • Item | null - The matching object, or null if it is not available.

HasItem(itemName: string, inRealInventory?: boolean)boolean

Checks whether it has item.

  • itemNamestring - The item name.
  • inRealInventoryboolean (optional) - Whether to use only the real inventory.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetAbilities()Ability[]

Retrieves the abilities.

Returned:

  • Ability[] - An array with the matching values.

GetAbilityByIndex(index: number)Ability | null

Retrieves the ability by index.

  • indexnumber - The index value.

Returned:

  • Ability | null - The matching object, or null if it is not available.

GetAbility(abilityName: string)Ability | null

Retrieves the ability.

  • abilityNamestring - The ability name.

Returned:

  • Ability | null - The matching object, or null if it is not available.

HasAbility(abilityName: string)boolean

Checks whether it has ability.

  • abilityNamestring - The ability name.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsLinkensProtected()boolean

Checks whether it is linkens protected.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsChannellingAbility()boolean

Checks whether it is channelling ability.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetActivity()Enum.GameActivity

Retrieves the activity.

Returned:


IsRunning()boolean

Checks whether it is running.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsAttacking()boolean

Checks whether it is attacking.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsSilenced()boolean

Checks whether it is silenced.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsStunned()boolean

Checks whether it is stunned.

Returned:

  • boolean - True if the condition is met, false otherwise.

HasAegis()boolean

Checks whether it has aegis.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsKillable()boolean

Checks whether it is killable.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetMinDamage()number

Retrieves the minimum damage.

Returned:

  • number - The requested minimum damage.

GetMaxDamage()number

Retrieves the maximum damage.

Returned:

  • number - The requested maximum damage.

GetBonusDamage()number

Retrieves the bonus damage.

Returned:

  • number - The requested bonus damage.

GetTrueDamage()number

Retrieves the true damage.

Returned:

  • number - The requested true damage.

GetTrueMaximumDamage()number

Retrieves the true maximum damage.

Returned:

  • number - The requested true maximum damage.

GetAttachment(attachmentName: string)Vector

Retrieves the attachment.

  • attachmentNamestring - The attachment name.

Returned:

  • Vector - The result of the call.

GetAttachmentByIndex(attachmentIndex: number)Vector

Retrieves the attachment by index.

  • attachmentIndexnumber - The attachment index.

Returned:

  • Vector - The result of the call.

GetMagicalDamageMultiplier()number

Retrieves the magical damage multiplier.

Returned:

  • number - The requested magical damage multiplier.

GetLastAttackTime()number

Retrieves the last attack time.

Returned:

  • number - The requested last attack time.

GetStateAfterDamage(state: null | EntityState, damage: number)EntityState

Retrieves the predicted state after applying damage.

  • statenull | EntityState - The state value.
  • damagenumber - The damage.

WARNING

Deprecated.

Returned:

  • EntityState - The result of the call.

MoveTo(position: Vector, queue?: boolean, showEffects?: boolean)void

Orders the unit to move to the specified position.

  • positionVector - The position to use.
  • queueboolean (optional) - Whether to queue the action.
  • showEffectsboolean (optional) - Whether to show default game effects.

GetTaggedAsVisibleByTeam()number

Retrieves the tagged as visible by team.

Returned:

  • number - The requested tagged as visible by team.