• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Question about HasUnitState

Status
Not open for further replies.

Mahado

Epic Member
Hello! I have small question about HasUnitState. Can I check with it if creature is using certain emote? If the creature is lying down?

Also, is there any way to check what bytes1 value is the creature affected by? GetBytesValue ? Or does it return something completely different.

Basically I'm going to apply sleep effect on creatures depending on their bytes1 or emote state.

- Mahado
 

Foereaper

Founder
HasUnitState uses the below enumerator:

Code:
enum UnitState
{
    UNIT_STATE_DIED            = 1,                     // player has fake death aura
    UNIT_STATE_MELEE_ATTACKING = 2,                     // player is melee attacking someone
    UNIT_STATE_STUNNED         = 8,
    UNIT_STATE_ROAMING         = 16,
    UNIT_STATE_CHASE           = 32,
    UNIT_STATE_FLEEING         = 128,
    UNIT_STATE_IN_FLIGHT       = 256,                     // player is in flight mode
    UNIT_STATE_FOLLOW          = 512,
    UNIT_STATE_ROOT            = 1024,
    UNIT_STATE_CONFUSED        = 2048,
    UNIT_STATE_DISTRACTED      = 4096,
    UNIT_STATE_ISOLATED        = 8192,                     // area auras do not affect other players
    UNIT_STATE_ATTACK_PLAYER   = 16384,
    UNIT_STATE_CASTING         = 32768,
    UNIT_STATE_POSSESSED       = 65536,
    UNIT_STATE_CHARGING        = 131072,
    UNIT_STATE_JUMPING         = 262144,
    UNIT_STATE_MOVE            = 1048576,
    UNIT_STATE_ROTATING        = 2097152,
    UNIT_STATE_EVADE           = 4194304,
    UNIT_STATE_ROAMING_MOVE    = 8388608,
    UNIT_STATE_CONFUSED_MOVE   = 16777216,
    UNIT_STATE_FLEEING_MOVE    = 33554432,
    UNIT_STATE_CHASE_MOVE      = 67108864,
    UNIT_STATE_FOLLOW_MOVE     = 134217728,
    UNIT_STATE_IGNORE_PATHFINDING = 268435456,                 // do not use pathfinding in any MovementGenerator
    UNIT_STATE_UNATTACKABLE    = UNIT_STATE_IN_FLIGHT,
    // for real move using movegen check and stop (except unstoppable flight)
    UNIT_STATE_MOVING          = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE,
    UNIT_STATE_CONTROLLED      = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING),
    UNIT_STATE_LOST_CONTROL    = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING),
    UNIT_STATE_SIGHTLESS       = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE),
    UNIT_STATE_CANNOT_AUTOATTACK     = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_CASTING),
    UNIT_STATE_CANNOT_TURN     = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_ROTATING),
    // stay by different reasons
    UNIT_STATE_NOT_MOVE        = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DIED | UNIT_STATE_DISTRACTED,
    UNIT_STATE_ALL_STATE       = -1                      //(UNIT_STATE_STOPPED | UNIT_STATE_MOVING | UNIT_STATE_IN_COMBAT | UNIT_STATE_IN_FLIGHT)
};

And yes, GetByteValue can be used on all byte types, like UNIT_FIELD_BYTES etc, check UpdateFields.h for a list of unit fields.
 
Last edited:

Mahado

Epic Member
Woah, took a while to find right values but I got it working with GetByteValue. <-- What awesome method that is. :d Thanks for the tip where to find it.

Solved for me.
 
Status
Not open for further replies.
Top