# Unit Behavior Enabled
Grammar — unit behavior is enabled
Flags —Native
|Function
Returns true if the specified unit has the specified behavior enabled.
# Arguments
unit
— Unitstring
<gamelink::Behavior> — Behavior
Returns — bool
native bool UnitBehaviorEnabled(
unit inUnit,
string inBehavior,
);
# Related
Category: Behavior / Basic
- Remove Behaviors By Category —
void
— UnitBehaviorRemoveCategory - Remove Behavior (Player) —
void
— UnitBehaviorRemovePlayer - Remove Behavior —
void
— UnitBehaviorRemove - Add Behavior (Player) —
void
— UnitBehaviorAddPlayer - Add Behavior —
void
— UnitBehaviorAdd - Set Behavior Count —
void
— libNtve_gf_SetBehaviorCount - Number Of Behaviors On Unit —
int
— UnitBehaviorCountAll - Unit Behavior —
string
<gamelink::Behavior> — UnitBehaviorGet - Unit Has Behavior —
bool
— UnitHasBehavior2 - Unit Has Behavior (Enabled) —
bool
— UnitHasBehavior - Unit Behavior Enabled —
bool
— UnitBehaviorEnabled - Stack Count Of Behavior On Unit —
int
— UnitBehaviorCount - Behavior Has Flag —
bool
— UnitBehaviorHasFlag - Transfer Behavior —
void
— UnitBehaviorTransfer - Set Unit Behavior Duration —
void
— UnitBehaviorSetDuration - Set Unit Behavior Duration Remaining —
void
— UnitBehaviorSetDurationRemaining - Duration Remaining Of Behavior On Unit —
fixed
— UnitBehaviorDuration - Duration Of Behavior On Unit —
fixed
— UnitBehaviorDurationTotal - Set Unit Behavior Spawn Count —
void
— UnitBehaviorSpawn - Unit Behavior Effect Player —
int
— UnitBehaviorEffectPlayer - Unit Behavior Effect Unit —
unit
— UnitBehaviorEffectUnit - Set Unit Behavior User Data —
void
— UnitBehaviorEffectTreeSetUserData - User Data Of Behavior On Unit —
fixed
— UnitBehaviorEffectTreeUserData - User Data Of Behavior On Unit Exists —
bool
— UnitBehaviorEffectTreeUserDataExists - Unit Behavior Changes —
void
— TriggerAddEventUnitBehaviorChange - Unit Behavior Changes From Category —
void
— TriggerAddEventUnitBehaviorChangeFromCategory - Triggering Behavior —
string
<gamelink::Behavior> — EventUnitBehavior - Triggering Behavior Change —
int
<preset::BehaviorChange> — EventUnitBehaviorChange - Unit Behavior Damage Modify Remaining —
fixed
— UnitBehaviorDamageModifyRemaining - Unit Behavior Damage Modify Limit —
fixed
— UnitBehaviorDamageModifyLimit - For Each Behavior On Unit — macro
# Examples
mods/heroes.stormmod — base.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.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/heroesdata.stormmod — base.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.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:3055
}
else {
if ((UnitBehaviorEnabled(lv_misha, "RexxarMishaLeashGracePeriod") == false)) {
UnitBehaviorAdd(lv_misha, "RexxarMishaLeashGracePeriod", lv_rexxar, 1);
}
mods/heroesdata.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.stormdata/LibHMTH.galaxy:215
// Conditions
if (testConds) {
if (!((UnitBehaviorEnabled(lv_targetUnit, "MalthaelReapersMarkTouchOfDeathDebuff") == true))) {
return false;
}