# Class Unit [-] [+]

Inherits all methods from: Object, WorldObject

## Methods

AddAura | Adds the Aura of the given spell entry on the given target from the Unit.
AddUnitState | Adds the given unit state for the Unit.
Attack | The Unit tries to attack a given target
AttackStop | The Unit stops attacking its target
CastCustomSpell | Casts the Spell at target Unit with custom basepoints or casters. See also Unit:CastSpell.
CastSpell | Makes the Unit cast the spell on the target.
CastSpellAoF | Makes the Unit cast the spell to the given coordinates, used for area effect spells.
ClearInCombat | Clears the Unit's combat
ClearUnitState | Removes the given unit state from the Unit.
CountPctFromCurHealth | Returns calculated percentage from Health
CountPctFromMaxHealth | Returns calculated percentage from Max Health
DeMorph | Unmorphs the Unit setting it's display ID back to the native display ID.
DealDamage | Makes the Unit damage the target Unit
DealHeal | Makes the Unit heal the target Unit with given spell
DisableMelee | Enables or disables whether or not the Unit can melee auto attack.
Dismount | Dismounts the Unit.
EmoteState | Makes the Unit perform the given emote continuously.
GetAttackTimer | Returns the Unit's attack timer of given [WeaponAttackType].
GetAura | Returns the Aura of the given spell entry on the Unit or nil.
GetAuraCount | Returns the total aura count of the given spell entry on the Unit or nil.
GetAuraEffect | Returns the AuraEffect of the given spell entry and spell effect index on the Unit or nil.
GetBaseSpellPower | Returns the Unit's base spell power
GetCharmGUID | Returns the GUID of the Unit's charmed entity.
GetCharmerGUID | Returns the Unit's charmer's GUID.
GetClass | Returns the Unit's class ID.
GetClassAsString | Returns the Unit's class' name in given or default locale or nil.
GetClassMask | Returns the class mask
GetControllerGUID | Returns the GUID of the Unit's charmer or owner.
GetControllerGUIDS | Returns the GUID of the Unit's charmer or owner or its own GUID.
GetCreatorGUID | Returns the Unit's creator's GUID.
GetCreatureType | Returns the Unit's creature type ID (enumerated in CreatureType.dbc).
GetCritterGUID | Returns the Critter Guid
GetCurrentSpell | Returns the currently casted Spell of given type or nil.
GetDisplayId | Returns the Unit's current display ID.
GetFaction | Returns the Unit's faction ID.
GetFollowingGUID | Returns the GUID of the entity the Unit is following.
GetFriendlyUnitsInRange | Returns a table containing friendly Unit's within given range of the Unit.
GetGender | Returns the Unit's gender.
GetHealth | Returns the Unit's health amount.
GetHealthPct | Returns the Unit's health percent.
GetLevel | Returns the Unit's level.
GetMaxHealth | Returns the Unit's max health.
GetMaxPower | Returns the Unit's max power amount for given power type.
GetMountId | Returns the Unit's mount's modelID.
GetMovementType | Returns the current movement type for this Unit.
GetNativeDisplayId | Returns the Unit's native/original display ID.
GetOwner | Returns the Unit's owner.
GetOwnerGUID | Returns the Unit's owner's GUID.
GetPetGUID | Returns the GUID of the Unit's pet.
GetPower | Returns the Unit's power amount for given power type.
GetPowerPct | Returns the Unit's power percent for given power type.
GetPowerType | Returns the Unit's current power type.
GetRace | Returns the Unit's race ID.
GetRaceAsString | Returns the Unit's race's name in given or default locale or nil.
GetRaceMask | Returns the race mask
GetResistance | Returns the Unit's resistance for given spell school.
GetSpeed | Returns the Unit's speed of given [UnitMoveType].
GetStandState | Returns the Unit's current stand state.
GetStat | Returns Unit's specified stat
GetUnfriendlyUnitsInRange | Returns a table containing unfriendly Unit's within given range of the Unit.
GetVehicle | Returns Unit's Vehicle object
GetVehicleKit | Returns Unit's Vehicle methods
GetVictim | Returns the Unit's current victim target or nil.
HasAura | Returns true if the Unit has an aura from the given spell entry (from caster guid).
HasUnitState | Returns true if the Unit has the given unit state.
HealthAbovePct | Returns true if the Unit's health is above the given percentage.
HealthBelowPct | Returns true if the Unit's health is below the given percentage.
InterruptSpell | Interrupts Unit's spell state, casting, etc.
IsAlive | Returns true if the Unit is alive.
IsArmorer | Returns true if the Unit is an armorer and can repair equipment.
IsAttackingPlayer | Returns true if the Unit is attacking a player.
IsAuctioneer | Returns true if the Unit an auctioneer.
IsBanker | Returns true if the Unit is a banker.
IsBattleMaster | Returns true if the Unit is a battle master.
IsCasting | Returns true if the Unit is casting a spell
IsCharmed | Returns true if the Unit is a charmed.
IsDead | Returns true if the Unit is dead.
IsDying | Returns true if the Unit is dying.
IsFlying | Returns true if the Unit is flying, false otherwise.
IsFullHealth | Returns true if the Unit has full health.
IsGossip | Returns true if the Unit is able to show a gossip window.
IsGuildMaster | Returns true if the Unit a guild master.
IsInAccessiblePlaceFor | Returns true if the Unit is in an accessible place for the given Creature.
IsInCombat | Returns true if the Unit is in combat.
IsInWater | Returns true if the Unit is in water.
IsInnkeeper | Returns true if the Unit an innkeeper.
IsMounted | Returns true if the Unit is mounted.
IsMoving | Returns true if the Unit is moving, false otherwise.
IsOnVehicle | Returns true if the Unit is on a Vehicle.
IsPvPFlagged | Returns true if the Unit flagged for PvP.
IsQuestGiver | Returns true if the Unit is a quest giver.
IsRooted | Returns true if the Unit is rooted.
IsServiceProvider | Returns true if the Unit provides services like vendor, training and auction.
IsSpiritGuide | Returns true if the Unit is a spirit guide.
IsSpiritHealer | Returns true if the Unit is a spirit healer.
IsSpiritService | Returns true if the Unit is a spirit guide or spirit healer.
IsStandState | Returns true if the Unit is standing.
IsStopped | Returns true if the Unit is not moving.
IsTabardDesigner | Returns true if the Unit is a tabard designer.
IsTaxi | Returns true if the Unit is a taxi master.
IsTrainer | Returns true if the Unit a trainer.
IsUnderWater | Returns true if the Unit is under water.
IsVendor | Returns true if the Unit is a vendor.
IsVisible | Returns true if the Unit is visible, false otherwise.
IsWithinMeleeRange | Returns true if the Unit's target is within melee range.
Kill | Makes the Unit kill the target Unit
ModifyPower | modifies the Unit's power amount for the given power type.
Mount | Mounts the Unit on the given displayID/modelID.
MoveChase | The Unit will chase the target
MoveClear | Clears the Unit's movement
MoveConfused | The Unit will move confused
MoveExpire | The Unit's movement expires and clears movement
MoveFleeing | The Unit will flee
MoveFollow | The Unit will follow the target
MoveHome | The Unit will move to its set home location
MoveIdle | The Unit will be idle
MoveJump | Makes the Unit jump to the coordinates
MoveRandom | The Unit will move at random
MoveStop | Stops the Unit's movement
MoveTo | The Unit will move to the coordinates
NearTeleport | Makes the Unit teleport to given coordinates within same map.
PerformEmote | Makes the Unit perform the given emote.
RemoveAllAuras | Removes all Aura's from the Unit.
RemoveArenaAuras | Removes all positive visible Aura's from the Unit.
RemoveAura | Removes Aura of the given spell entry from the Unit.
RemoveBindSightAuras | Removes all bind sight auras from the Unit.
RemoveCharmAuras | Removes all charm auras from the Unit.
ResetAttackTimer | Resets the Unit's attack timer of given [WeaponAttackType].
RestoreDisplayId | Restores the Units display ID to default
RestoreFaction | Restores the Units faction to default
SendChatMessageToPlayer | Sends chat message to Player
SendUnitEmote | The Unit will emote the message
SendUnitSay | The Unit will say the message
SendUnitSayTo | The Unit will say the message
SendUnitWhisper | The Unit will whisper the message to a Player
SendUnitYell | The Unit will yell the message
SendUnitYellTo | The Unit will yell the message
SetAttackTimer | Set the Unit's attack timer of given [WeaponAttackType] to given time in milliseconds.
SetCanFly | Sets whether or not the Unit can fly.
SetCombatReach | Sets the Unit's combat reach to the given value.
SetConfused | Confuses the Unit, if 'false' specified, the Unit is no longer confused.
SetCreatorGUID | Sets creator GUID
SetCritterGUID |
SetDisplayId | Sets the Unit's modelID.
SetEmoteState | Sets the Unit's emote state
SetFFA | Sets the Unit's FFA flag on or off.
SetFacing | Sets the Unit's facing/orientation.
SetFacingToObject | Sets the Unit to face the given WorldObject's direction.
SetFaction | Sets the Unit's faction.
SetFeared | Fears the Unit, if 'false' specified, the Unit is no longer feared.
SetFixedMeleeRange | Sets the Unit's melee attack range
SetHealth | Sets the Unit's health.
SetImmuneTo | Sets a mechanic immunity for the Unit.
SetInCombatWith | Sets the Unit in combat with the `enemy` Unit.
SetLevel | Sets the Unit's level.
SetMaxHealth | Sets the Unit's max health.
SetMaxPower | Sets the Unit's max power amount for the given power type.
SetName | Sets the Unit's name internally.
SetNativeDisplayId | Sets the Unit's native/default modelID.
SetOwnerGUID | Sets the Unit's owner GUID to given GUID.
SetPetGUID | Sets pet GUID
SetPower | Sets the Unit's power amount for the given power type.
SetPowerType | Sets the Unit's power type.
SetPvP | Sets the Unit's PvP on or off.
SetRooted | Roots the Unit to the ground, if 'false' specified, unroots the Unit.
SetSanctuary | Sets the Unit's sanctuary flag on or off.
SetSheath | Sets the Unit's sheath state.
SetSpeed | Sets the Unit's speed of given [UnitMoveType] to given rate. If forced, packets sent to clients forcing the visual change.
SetStandState | Sets the Unit's stand state
SetStunned | Sets whether or not the Unit is stunned.
SetVisible | Sets whether or not the Unit is visible.
SetWaterWalk | Toggles (Sets) Unit's water walking
SpellDamageBonusTaken | Returns the Unit's spell damage bonus taken.
StopSpellCast | Stops the Unit's current spell cast
UpdateObjectVisibility | Updates the visibility of the Unit.

# Keyboard shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

# Search tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct` (or `str`), `enum`, `trait`, `typedef` (or `tdef`).

Generated on
© 2010 - 2024 Eluna Lua Engine