# Unit Behavior Enabled

Grammarunit behavior is enabled
FlagsNative | Function

Returns true if the specified unit has the specified behavior enabled.

# Arguments

  • unit — Unit
  • string<gamelink::Behavior> — Behavior

Returns — bool

native bool UnitBehaviorEnabled(
	unit inUnit,
	string inBehavior,
);

Category: Behavior / Basic

# Examples

mods/heroes.stormmodbase.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmap/MapScript.galaxy:5864

        }

        if ((UnitIsAlive(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit) == true) && (libStEx_gf_PlayerIsInCombat(libStEx_gv_pLAYER_01_USER) == false) && (libGame_gf_MountEnabled(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit) == true) && ((UnitHasBehavior2(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == false) || (UnitBehaviorEnabled(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == false) || (UnitBehaviorCount(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == 0))) {
            if ((lv_originalLoc == null)) {
                lv_originalLoc = UnitGetPosition(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit);

mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmapMapScript.galaxy:5864

        }

        if ((UnitIsAlive(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit) == true) && (libStEx_gf_PlayerIsInCombat(libStEx_gv_pLAYER_01_USER) == false) && (libGame_gf_MountEnabled(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit) == true) && ((UnitHasBehavior2(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == false) || (UnitBehaviorEnabled(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == false) || (UnitBehaviorCount(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit, "Mounted") == 0))) {
            if ((lv_originalLoc == null)) {
                lv_originalLoc = UnitGetPosition(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:3046


    if ((DistanceBetweenPoints(UnitGetPosition(lv_misha), UnitGetPosition(lv_rexxar)) >= libGDHL_gv_rexxar_Misha_LeashRange_Max_C) && (lv_currentState != libGDHL_ge_MishaState_Leashing) && (lv_currentState != libGDHL_ge_MishaState_Following)) {
        if ((((UnitBehaviorEnabled(lv_misha, "RexxarMishaLeashTimeToLeash") == true) || (DistanceBetweenPoints(UnitGetPosition(lv_misha), UnitGetPosition(lv_rexxar)) >= libGDHL_gv_rexxar_Misha_LeashRange_Immediate_C))) && (UnitHasBehavior2(lv_rexxar, "UsingVehicle") == false)) {
            UnitIssueOrder(lv_misha, OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(lv_rexxar), 3.0, libNtve_gf_RandomAngle())), c_orderQueueReplace);
            lv_currentState = libGDHL_ge_MishaState_Leashing;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:3055

        }
        else {
            if ((UnitBehaviorEnabled(lv_misha, "RexxarMishaLeashGracePeriod") == false)) {
                UnitBehaviorAdd(lv_misha, "RexxarMishaLeashGracePeriod", lv_rexxar, 1);
            }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:3203

        }

        if ((UnitOrderCount(lv_rexxar) != 0) && (UnitBehaviorEnabled(lv_misha, "RexxarMishaHold") == false) && (libGDHL_gv_heroRexxarMishaLastKnownTargetLocation[lv_player] == null)) {
            if ((OrderGetAbilityCommand(UnitOrder(lv_rexxar, 0)) == AbilityCommand("attack", 0))) {
                if ((UnitOrderIsAcquired(lv_rexxar, 0) == true) && (OrderGetTargetPosition(UnitOrder(lv_rexxar, 1)) == UnitGetPosition(lv_rexxar))) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:3229

                if ((OrderGetAbilityCommand(UnitOrder(lv_rexxar, 0)) == AbilityCommand("move", 0)) && (UnitHasBehavior2(lv_misha, "RexxarMishaManualOrder") == false)) {
                    UnitCreateEffectUnit(lv_rexxar, "RexxarMishaCommandRemoveTargetPriorityBuffSearch", lv_rexxar);
                    if ((DistanceBetweenPoints(OrderGetTargetPosition(UnitOrder(lv_rexxar, 0)), UnitGetPosition(lv_misha)) > 4.0) && (UnitBehaviorEnabled(lv_misha, "RexxarMishaHold") == false)) {
                        libGDHL_gf_HeroRexxarOrderMishaMoveNearPoint(lv_rexxar, lv_misha, OrderGetTargetPosition(UnitOrder(lv_rexxar, 0)));
                        lv_currentState = libGDHL_ge_MishaState_Moving;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/StartingExperienceLib.galaxy:3120


        if ((UnitIsAlive(libGame_gv_players[1].lv_heroUnit) == true) && (libStEx_gf_PlayerIsInCombat(1) == false) && (libStEx_gv_sE_TrainingModeTipDisplaying == false)) {
            if ((UnitHasBehavior2(libGame_gv_players[1].lv_heroUnit, "ShrubStatusController") == true) && (UnitBehaviorEnabled(libGame_gv_players[1].lv_heroUnit, "ShrubStatusController") == true) && (UnitBehaviorCount(libGame_gv_players[1].lv_heroUnit, "ShrubStatusController") > 0)) {
                libStEx_gf_SE_TrainingModeTipDisplay(libStEx_ge_SE_TrainingModeTips_Bushes);
                libStEx_gf_SE_TrainingModeTipSetDisplayed(libStEx_ge_SE_TrainingModeTips_Bushes);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/StartingExperienceLib.galaxy:3758

        }

        if ((UnitIsAlive(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit) == true) && (libStEx_gf_PlayerIsInCombat(1) == false) && (libGame_gf_MountEnabled(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit) == true) && ((UnitHasBehavior2(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit, "Mounted") == false) || (UnitBehaviorEnabled(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit, "Mounted") == false) || (UnitBehaviorCount(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit, "Mounted") == 0))) {
            if ((lv_originalLoc == null)) {
                lv_originalLoc = UnitGetPosition(libGame_gv_players[libStEx_gv_sE_Player].lv_heroUnit);

mods/heroesmapmods/battlegroundmapmods/tombofthespiderqueen.stormmodbase.stormdata/LibMSOC.galaxy:451

    lv_itSoulCage = 1;
    for ( ; ( (auto9988F4EF_ai >= 0 && lv_itSoulCage <= auto9988F4EF_ae) || (auto9988F4EF_ai < 0 && lv_itSoulCage >= auto9988F4EF_ae) ) ; lv_itSoulCage += auto9988F4EF_ai ) {
        if ((UnitIsValid(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units) == true) && (UnitBehaviorEnabled(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, "MacguffinActivated") == true)) {
            return true;
        }

mods/heromods/alexstrasza.stormmodbase.stormdata/LibHALE.galaxy:223

    auto3C680C14_var = 1;
    for ( ; auto3C680C14_var <= auto3C680C14_ae; auto3C680C14_var += 1 ) {
        if ((UnitBehaviorEnabled(lv_oldUnit, "AlexstraszaBlessingOfTheRed") == true) && (UnitFilterMatch(lv_newUnit, UnitGetOwner(lv_oldUnit), UnitFilter(0, 0, 0, (1 << (c_targetFilterAITargetableStructure - 32)))) == true)) {
            lv_alexstraszaUnit = libGame_gv_players[auto3C680C14_var].lv_heroUnit;
            UnitCreateEffectUnit(lv_alexstraszaUnit, "AlexstraszaBlessingOfTheRedRemoveBehavior", lv_oldUnit);

mods/heromods/malthael.stormmodbase.stormdata/LibHMTH.galaxy:215

    // Conditions
    if (testConds) {
        if (!((UnitBehaviorEnabled(lv_targetUnit, "MalthaelReapersMarkTouchOfDeathDebuff") == true))) {
            return false;
        }