# CDOTA_BaseNPC

extends CBaseFlex

Function Description Client
handle AddAbility(pszAbilityName) Add an ability to this unit by name.
void AddActivityModifier(szName) Add an activity modifier that affects future StartGesture calls
handle AddItem(hItem) Add an item to this unit's inventory.
handle AddItemByName(pszItemName) Add an item to this unit's inventory.
handle AddNewModifier(hCaster, hAbility, pszScriptName, hModifierTable) 给一个单位添加modifier,hModifierTable可以传入持续时间和其他自定义参数,自定义参数可以在modifier中获得。
void AddNoDraw() Adds the no draw flag.
void AddSpeechBubble(iBubble, pszSpeech, flDuration, unOffsetX, unOffsetY) Add a speech bubble(1-4 live at a time) to this NPC.
void AlertNearbyUnits(hAttacker, hAbility)
void AngerNearbyUnits()
void AttackNoEarlierThan(flTime)
bool AttackReady()
float BoundingRadius2D()
bool CanEntityBeSeenByMyTeam(hEntity) Check FoW to see if an entity is visible.
bool CanSellItems() Query if this unit can sell items.
void CastAbilityImmediately(hAbility, iPlayerIndex) Cast an ability immediately.
void CastAbilityNoTarget(hAbility, iPlayerIndex) Cast an ability with no target.
void CastAbilityOnPosition(vPosition, hAbility, iPlayerIndex) Cast an ability on a position.
void CastAbilityOnTarget(hTarget, hAbility, iPlayerIndex) Cast an ability on a target entity.
void CastAbilityToggle(hAbility, iPlayerIndex) Toggle an ability.
void ClearActivityModifiers() Clear Activity modifiers
void DestroyAllSpeechBubbles()
void DisassembleItem(hItem) Disassemble the passed item in this unit's inventory.
void DropItemAtPosition(vDest, hItem) Drop an item at a given point.
void DropItemAtPositionImmediate(hItem, vPosition) Immediately drop a carried item at a given position.
void EjectItemFromStash(hItem) Drops the selected item out of this unit's stash.
void FaceTowards(vTarget) This unit will be set to face the target point.
void FadeGesture(nActivity) Fade and remove the given gesture activity.
handle FindAbilityByName(pAbilityName) Retrieve an ability by name from the unit.
table FindAllModifiers() Returns a table of all of the modifiers on the NPC.
table FindAllModifiersByName(pszScriptName) Returns a table of all of the modifiers on the NPC with the passed name (modifierName)
handle FindItemInInventory(pszItemName) Get handle to first item in inventory, else nil.
handle FindModifierByName(pszScriptName) Return a handle to the modifier of the given name if found, else nil (string Name )
handle FindModifierByNameAndCaster(pszScriptName, hCaster) Return a handle to the modifier of the given name from the passed caster if found, else nil ( string Name, hCaster )
void ForceKill(bReincarnate) Kill this unit immediately.
void ForcePlayActivityOnce(nActivity) Play an activity once, and then go back to idle.
handle GetAbilityByIndex(iIndex) Retrieve an ability by index from the unit.
int GetAbilityCount() ✔️
float GetAcquisitionRange() Gets the range at which this unit will auto-acquire.
float GetAdditionalBattleMusicWeight() Combat involving this creature will have this weight added to the music calcuations.
handle GetAggroTarget() Returns this unit's aggro target.
float GetAttackAnimationPoint()
int GetAttackCapability()
int GetAttackDamage() Returns a random integer between the minimum and maximum base damage of the unit.
float GetAttackRangeBuffer() Gets the attack range buffer.
float GetAttackSpeed() ✔️
handle GetAttackTarget()
float GetAttacksPerSecond() ✔️
int GetAverageTrueAttackDamage(hTarget) Returns the average value of the minimum and maximum damage values.
int GetBaseAttackRange()
float GetBaseAttackTime() ✔️
int GetBaseDamageMax() Get the maximum attack damage of this unit.
int GetBaseDamageMin() Get the minimum attack damage of this unit.
int GetBaseDayTimeVisionRange() Returns the vision range before modifiers.
float GetBaseHealthRegen()
float GetBaseMagicalResistanceValue() Returns base magical armor value. ✔️
float GetBaseMaxHealth() Gets the base max health value.
float GetBaseMoveSpeed() ✔️
int GetBaseNightTimeVisionRange() Returns the vision range after modifiers.
float GetBonusManaRegen() This Mana regen is derived from constant bonuses like Basilius.
float GetCastPoint(bAttack)
float GetCastRangeBonus() ✔️
handle GetCloneSource() Get clone source (Meepo Prime, if this is a Meepo)
float GetCollisionPadding() Returns the size of the collision padding around the hull. ✔️
float GetCooldownReduction() ✔️
float GetCreationTime()
handle GetCurrentActiveAbility() Get the ability this unit is currently casting.
int GetCurrentVisionRange() Gets the current vision range. ✔️
handle GetCursorCastTarget()
Vector GetCursorPosition()
bool GetCursorTargetingNothing()
int GetDayTimeVisionRange() Returns the vision range after modifiers. ✔️
int GetDeathXP() Get the XP bounty on this unit.
float GetDisplayAttackSpeed() Attack speed expressed as constant value
float GetEvasion()
handle GetForceAttackTarget()
int GetGoldBounty() Get the gold bounty on this unit.
float GetHasteFactor() ✔️
int GetHealthDeficit() Returns integer amount of health missing from max.
int GetHealthPercent() Get the current health percent of the unit. ✔️
float GetHealthRegen()
float GetHullRadius() Get the collision hull radius of this NPC. ✔️
float GetIdealSpeed() Returns speed after all modifiers. ✔️
float GetIdealSpeedNoSlows() Returns speed after all modifiers, but excluding those that reduce speed. ✔️
float GetIncreasedAttackSpeed() ✔️
handle GetInitialGoalEntity() Returns the initial waypoint goal for this NPC.
Vector GetInitialGoalPosition() Get waypoint position for this NPC.
handle GetItemInSlot(i) Returns nth item in inventory slot (index is zero based).
float GetLastAttackTime()
float GetLastDamageTime() Get the last time this NPC took damage
float GetLastIdleChangeTime() Get the last game time that this unit switched to/from idle state.
int GetLevel() Returns the level of this unit. ✔️
float GetMagicalArmorValue() Returns current magical armor value. ✔️
int GetMainControllingPlayer() Returns the player ID of the controlling player.
float GetMana() Get the mana on this unit. ✔️
int GetManaPercent() Get the percent of mana remaining.
float GetManaRegen() ✔️
float GetMaxMana() Get the maximum mana of this unit. ✔️
int GetMaximumGoldBounty() Get the maximum gold bounty for this unit.
int GetMinimumGoldBounty() Get the minimum gold bounty for this unit.
float GetModelRadius() ✔️
int GetModifierCount() How many modifiers does this unit have?
string GetModifierNameByIndex(nIndex) Get a modifier name by index.
int GetModifierStackCount(pszScriptName, hCaster) Gets the stack count of a given modifier. ✔️
float GetMoveSpeedModifier(flBaseSpeed, bReturnUnslowed) ✔️
bool GetMustReachEachGoalEntity() Set whether this NPC is required to reach each goal entity, rather than being allowed to unkink their path.
bool GetNeverMoveToClearSpace() If set to true, we will never attempt to move this unit to clear space, even when it unphases.
int GetNightTimeVisionRange() Returns the vision range after modifiers. ✔️
int GetOpposingTeamNumber() ✔️
float GetPaddedCollisionRadius() Get the collision hull radius (including padding) of this NPC. ✔️
float GetPhysicalArmorBaseValue() Returns base physical armor value. ✔️
float GetPhysicalArmorValue(bIgnoreBase) Returns current physical armor value. ✔️
handle GetPlayerOwner() Returns the player that owns this unit.
int GetPlayerOwnerID() Get the owner player ID for this unit. ✔️
int GetProjectileSpeed()
float GetRangeToUnit(hNPC)
string GetRangedProjectileName()
float GetSecondsPerAttack() ✔️
float GetSpellAmplification(bBaseOnly)
float GetStatusResistance()
int GetTotalPurchasedUpgradeGoldCost() Get how much gold has been spent on ability upgrades. ✔️
string GetUnitLabel() ✔️
string GetUnitName() Get the name of this unit. ✔️
void GiveMana(flMana) Give mana to this unit, this can be used for mana gained by abilities or item usage.
bool HasAbility(pszAbilityName) See whether this unit has an ability by name.
bool HasAnyActiveAbilities()
bool HasAttackCapability() ✔️
bool HasFlyMovementCapability() ✔️
bool HasFlyingVision() ✔️
bool HasGroundMovementCapability() ✔️
bool HasInventory() Does this unit have an inventory.
bool HasItemInInventory(pItemName) See whether this unit has an item by name. ✔️
bool HasModifier(pszScriptName) Sees if this unit has a given modifier. ✔️
bool HasMovementCapability() ✔️
bool HasScepter() 判断单位是否拥有阿哈利姆神杖升级效果 ✔️
void Heal(flAmount, hInflictor) Heal this unit.
void Hold() Hold position.
void Interrupt()
void InterruptChannel()
void InterruptMotionControllers(bFindClearSpace)
bool IsAlive() Is this unit alive?
bool IsAncient() Is this unit an Ancient? ✔️
bool IsAttackImmune() ✔️
bool IsAttacking()
bool IsAttackingEntity(hEntity)
bool IsBarracks() Is this unit a Barracks? ✔️
bool IsBlind() ✔️
bool IsBlockDisabled()
bool IsBoss() Is this unit a boss? ✔️
bool IsBuilding() Is this unit a building? ✔️
bool IsChanneling() Is this unit currently channeling a spell?
bool IsClone() Is this unit a clone? (Meepo)
bool IsCommandRestricted() ✔️
bool IsConsideredHero() Is this unit a considered a hero for targeting purposes? ✔️
bool IsControllableByAnyPlayer() Is this unit controlled by any non-bot player? ✔️
bool IsCourier() Is this unit a courier? ✔️
bool IsCreature() Is this a Creature type NPC? ✔️
bool IsCreep() Is this unit a creep? ✔️
bool IsDeniable() ✔️
bool IsDisarmed() ✔️
bool IsDominated() ✔️
bool IsEvadeDisabled() ✔️
bool IsFort() Is this unit an Ancient? ✔️
bool IsFrozen() ✔️
bool IsHero() Is this a hero or hero illusion? ✔️
bool IsHexed() ✔️
bool IsIdle() Is this creature currently idle?
bool IsIllusion() ✔️
bool IsInRangeOfShop(nShopType, bPhysical) Ask whether this unit is in range of the specified shop ( DOTA_SHOP_TYPE shop, bool bMustBePhysicallyNear
bool IsInvisible() ✔️
bool IsInvulnerable() ✔️
bool IsLowAttackPriority() ✔️
bool IsMagicImmune() ✔️
bool IsMovementImpaired()
bool IsMoving() Is this unit moving? ✔️
bool IsMuted() ✔️
bool IsNeutralUnitType() Is this a neutral? ✔️
bool IsNightmared() ✔️
bool IsOpposingTeam(nTeam)
bool IsOther() Is this unit a ward-type unit? ✔️
bool IsOutOfGame() ✔️
bool IsOwnedByAnyPlayer() Is this unit owned by any non-bot player? ✔️
bool IsPhantom() Is this a phantom unit? ✔️
bool IsPhantomBlocker()
bool IsPhased()
bool IsPositionInRange(vPosition, flRange)
bool IsRangedAttacker() Is this unit a ranged attacker? ✔️
bool IsRealHero() Is this a real hero? ✔️
bool IsRooted() ✔️
bool IsShrine() Is this a shrine?
bool IsSilenced() ✔️
bool IsSpeciallyDeniable() ✔️
bool IsStunned() ✔️
bool IsSummoned() Is this unit summoned? ✔️
bool IsTempestDouble()
bool IsTower() Is this a tower? ✔️
bool IsUnableToMiss()
bool IsUnselectable() ✔️
bool IsUntargetable() ✔️
void Kill(hAbility, hAttacker) Kills this NPC, with the params Ability and Attacker.
void MakeIllusion()
void MakePhantomBlocker()
void MakeVisibleDueToAttack(iTeam, flRadius)
void MakeVisibleToTeam(iTeam, flDuration)
void ManageModelChanges()
void ModifyHealth(iDesiredHealthValue, hAbility, bLethal, iAdditionalFlags) Sets the health to a specific value, with optional flags or inflictors.
void MoveToNPC(hNPC) Move to follow a unit.
void MoveToNPCToGiveItem(hNPC, hItem) Give an item to another unit.
void MoveToPosition(vDest) Issue a Move-To command.
void MoveToPositionAggressive(vDest) Issue an Attack-Move-To command.
void MoveToTargetToAttack(hTarget) Move to a target to attack.
bool NoHealthBar() ✔️
bool NoTeamMoveTo() ✔️
bool NoTeamSelect() ✔️
bool NoUnitCollision() ✔️
bool NotOnMinimap() ✔️
bool NotOnMinimapForEnemies() ✔️
void NotifyWearablesOfModelChange(bOriginalModel)
bool PassivesDisabled() 判断该单位是否被禁用被动 ✔️
void PatrolToPosition(vDest) Issue a Patrol-To command.
void PerformAttack(hTarget, bUseCastAttackOrb, bProcessProcs, bSkipCooldown, bIgnoreInvis, bUseProjectile, bFakeAttack, bNeverMiss) Performs an attack on a target.
void PickupDroppedItem(hItem) Pick up a dropped item.
void PickupRune(hItem) Pick up a rune.
void PlayVCD(pVCD) Play a VCD on the NPC.
bool ProvidesVision() ✔️
void Purge(bRemovePositiveBuffs, bRemoveDebuffs, bFrameOnly, bRemoveStuns, bRemoveExceptions) (bool RemovePositiveBuffs, bool RemoveDebuffs, bool BuffsCreatedThisFrameOnly, bool RemoveStuns, bool RemoveExceptions
void ReduceMana(flAmount) Remove mana from this unit, this can be used for involuntary mana loss, not for mana that is spent.
void RemoveAbility(pszAbilityName) Remove an ability from this unit by name.
void RemoveAbilityByHandle(hAbility) Remove the passed ability from this unit.
void RemoveGesture(nActivity) Remove the given gesture activity.
void RemoveHorizontalMotionController(hBuff)
void RemoveItem(hItem) Removes the passed item from this unit's inventory and deletes it.
void RemoveModifierByName(pszScriptName) Removes a modifier.
void RemoveModifierByNameAndCaster(pszScriptName, hCaster) Removes a modifier that was cast by the given caster.
void RemoveNoDraw() Remove the no draw flag.
void RemoveVerticalMotionController(hBuff)
void RespawnUnit() Respawns the target unit if it can be respawned.
float Script_GetAttackRange() Gets this unit's attack range after all modifiers. ✔️
void SellItem(hItem) Sells the passed item in this unit's inventory.
void SetAbilityByIndex(hAbility, iIndex) Set the ability by index.
void SetAcquisitionRange(nRange)
void SetAdditionalBattleMusicWeight(flWeight) Combat involving this creature will have this weight added to the music calcuations.
void SetAggroTarget(hAggroTarget) Set this unit's aggro target to a specified unit.
void SetAttackCapability(iAttackCapabilities)
void SetAttacking(hAttackTarget)
void SetBaseAttackTime(flBaseAttackTime)
void SetBaseDamageMax(nMax) Sets the maximum base damage.
void SetBaseDamageMin(nMin) Sets the minimum base damage.
void SetBaseHealthRegen(flHealthRegen)
void SetBaseMagicalResistanceValue(flMagicalResistanceValue) Sets base magical armor value.
void SetBaseManaRegen(flManaRegen)
void SetBaseMaxHealth(flBaseMaxHealth) Set a new base max health value.
void SetBaseMoveSpeed(iMoveSpeed)
void SetCanSellItems(bCanSell) Set whether or not this unit is allowed to sell items (bCanSellItems)
void SetControllableByPlayer(iIndex, bSkipAdjustingPosition) Set this unit controllable by the player with the passed ID.
void SetCursorCastTarget(hEntity)
void SetCursorPosition(vLocation)
void SetCursorTargetingNothing(bTargetingNothing)
void SetCustomHealthLabel(pLabel, r, g, b)
void SetDayTimeVisionRange(iRange) Set the base vision range.
void SetDeathXP(iXPBounty) Set the XP bounty on this unit.
void SetForceAttackTarget(hNPC)
void SetForceAttackTargetAlly(hNPC)
void SetHasInventory(bHasInventory) Set if this unit has an inventory.
void SetHullRadius(flHullRadius) Set the collision hull radius of this NPC.
void SetIdleAcquire(bIdleAcquire)
void SetInitialGoalEntity(hGoal) Sets the initial waypoint goal for this NPC.
void SetInitialGoalPosition(vPosition) Set waypoint position for this NPC.
void SetMana(flMana) Set the mana on this unit.
void SetMaxMana(flMaxMana) Set the maximum mana of this unit.
void SetMaximumGoldBounty(iGoldBountyMax) Set the maximum gold bounty for this unit.
void SetMinimumGoldBounty(iGoldBountyMin) Set the minimum gold bounty for this unit.
void SetModifierStackCount(pszScriptName, hCaster, nStackCount) Sets the stack count of a given modifier.
void SetMoveCapability(iMoveCapabilities)
void SetMustReachEachGoalEntity(must) Set whether this NPC is required to reach each goal entity, rather than being allowed to unkink their path.
void SetNeverMoveToClearSpace(neverMoveToClearSpace) If set to true, we will never attempt to move this unit to clear space, even when it unphases.
void SetNightTimeVisionRange(iRange) Returns the vision range after modifiers.
void SetOrigin(vLocation) Set the unit's origin.
void SetOriginalModel(pszModelName) Sets the original model of this entity, which it will tend to fall back to anytime its state changes.
void SetPhysicalArmorBaseValue(flPhysicalArmorValue) Sets base physical armor value.
void SetRangedProjectileName(pProjectileName)
void SetRevealRadius(revealRadius) sets the client side map reveal radius for this unit
void SetShouldDoFlyHeightVisual(bShouldVisuallyFly)
void SetStolenScepter(bStolenScepter)
void SetUnitCanRespawn(bCanRespawn)
void SetUnitName(pName)
bool ShouldIdleAcquire()
void SpendMana(flManaSpent, hAbility) Spend mana from this unit, this can be used for spending mana from abilities or item usage.
void StartGesture(nActivity) Add the given gesture activity.
void StartGestureWithPlaybackRate(nActivity, flRate) Add the given gesture activity with a playback rate override.
void Stop() Stop the current order.
void StopFacing()
void SwapAbilities(pAbilityName1, pAbilityName2, bEnable1, bEnable2) Swaps the slots of the two passed abilities and sets them enabled/disabled.
void SwapItems(nSlot1, nSlot2) Swap the contents of two item slots (slot1, slot2)
handle TakeItem(hItem) Removed the passed item from this unit's inventory.
float TimeUntilNextAttack()
bool TriggerModifierDodge()
bool TriggerSpellAbsorb(hAbility)
void TriggerSpellReflect(hAbility) Trigger the Lotus Orb-like effect.(hAbility)
void UnHideAbilityToSlot(pszAbilityName, pszReplacedAbilityName) Makes the first ability unhidden, and puts it where second ability currently is. Will do nothing if the first ability is already unhidden and in a valid slot.
bool UnitCanRespawn() ✔️