# Duration Of Behavior On Unit

Grammar — Get behavior duration on unit unit
FlagsNative | Function

Gets a behavior duration on a unit.

# Arguments

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

Returns — fixed

native fixed UnitBehaviorDurationTotal(
	unit inUnit,
	string behavior,
);

Category: Behavior / Basic

# Examples

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


        }
        if ((UnitBehaviorDurationTotal(lv_target, lv_triggeringPoison) > 9.0)) {
            UnitBehaviorSetDurationRemaining(lv_target, lv_triggeringPoison, 9.0);
            UnitBehaviorSetDurationRemaining(lv_target, "DryadNaturesToxinVisual3", 3.0);

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


        }
        if ((UnitBehaviorDurationTotal(lv_target, lv_triggeringPoison) > 9.0)) {
            UnitBehaviorSetDurationRemaining(lv_target, lv_triggeringPoison, 9.0);
            UnitBehaviorSetDurationRemaining(lv_target, "DryadNaturesToxinVisual3", 3.0);

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

    if ((EventUnitBehaviorChange() == c_unitBehaviorChangeCreate)) {
        UnitBehaviorAdd(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", lv_stunnedUnit, 1);
        UnitBehaviorSetDuration(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDurationTotal(lv_eTC, "L90ETCMoshPitChannel"));
        UnitBehaviorSetDurationRemaining(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDuration(lv_eTC, "L90ETCMoshPitChannel"));
    }

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

        }

        UnitBehaviorSetDuration(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDurationTotal(lv_eTC, "L90ETCMoshPitChannel"));
        UnitBehaviorSetDurationRemaining(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDuration(lv_eTC, "L90ETCMoshPitChannel"));
    }

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

        UnitBehaviorSetDuration(lv_leoric, "LeoricUndying", TimerGetRemaining(libGame_gv_players[lv_leoricPlayer].lv_respawnTimer));
        UnitBehaviorSetDuration(lv_leoric, "Dead", TimerGetRemaining(libGame_gv_players[lv_leoricPlayer].lv_respawnTimer));
        libGDHL_gv_hero_Leoric_Undying_Dead_Duration[lv_leoricPlayer] = UnitBehaviorDurationTotal(lv_leoric, "LeoricUndying");
    }
    else {

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

        UnitBehaviorSetDuration(lv_leoric, "LeoricUndying", 0.0);
        UnitBehaviorSetDuration(lv_leoric, "Dead", 0.0);
        libGDHL_gv_hero_Leoric_Undying_Dead_Duration[lv_leoricPlayer] = UnitBehaviorDurationTotal(lv_leoric, "LeoricUndying");
    }
    CatalogFieldValueSetFixed(c_gameCatalogEffect, "LeoricUndyingLifeRegenModifyUnit", "VitalArray[" + IntToString(0) + "].ChangeFraction", lv_leoricPlayer, (0.5 / (libGDHL_gv_hero_Leoric_Undying_Dead_Duration[lv_leoricPlayer] - 2.0)));

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

        }
        if ((UnitIsAlive(lv_rexxarUnit) == true)) {
            TimerStart(libGDHL_gv_mishaDeathTimer[lv_rexxarPlayer], UnitBehaviorDurationTotal(lv_rexxarUnit, "RexxarSpiritBondCooldown"), false, c_timeGame);
            libUIUI_gf_UIPartyFramePetDies(lv_rexxarPlayer, libGDHL_gv_mishaDeathTimer[lv_rexxarPlayer]);
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:15305

    }

    lv_duration = UnitBehaviorDurationTotal(lv_triggeringUnit, EventUnitBehavior());
    libGame_gf_AddtoAwardValue(lv_caster, lv_duration, libGame_ge_SecondaryAwards_Silencer);
    return true;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:15403

    }

    lv_duration = UnitBehaviorDurationTotal(lv_triggeringUnit, EventUnitBehavior());
    if ((lv_duration < 10.0)) {
        libGame_gf_AddtoAwardValue(lv_caster, lv_duration, libGame_ge_SecondaryAwards_Stunner);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:15445

    }

    lv_duration = UnitBehaviorDurationTotal(lv_triggeringUnit, EventUnitBehavior());
    libGame_gf_AddtoAwardValue(lv_caster, lv_duration, libGame_ge_SecondaryAwards_Trapper);
    return true;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:20153

    }

    lv_duration = UnitBehaviorDurationTotal(lv_triggeringUnit, EventUnitBehavior());
    if ((lv_duration > 10.0)) {
        lv_duration = 10.0;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/UILib.galaxy:4277

    lv_heroUnit = libGame_gv_players[lp_player].lv_unitStatusBarsMonitorUnit_Channel;
    if (((UnitBehaviorDuration(lv_heroUnit, lp_behavior) >= UnitBehaviorDuration(lv_heroUnit, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayer[lp_player])) || (CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lp_behavior, "DisplayPriority", c_playerAny) > CatalogFieldValueGetAsInt(c_gameCatalogBehavior, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayer[lp_player], "DisplayPriority", c_playerAny)))) {
        if ((libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayer[lp_player] != "") && (UnitBehaviorDurationTotal(lv_heroUnit, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayer[lp_player]) > 0.0) && (CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lp_behavior, "DisplayPriority", c_playerAny) < CatalogFieldValueGetAsInt(c_gameCatalogBehavior, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayer[lp_player], "DisplayPriority", c_playerAny))) {
            return ;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/UILib.galaxy:4299

    lv_heroUnit = libGame_gv_players[lp_player].lv_unitStatusBarsMonitorUnit_Channel;
    if (((UnitBehaviorDuration(lv_heroUnit, lp_behavior) >= UnitBehaviorDuration(lv_heroUnit, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayerRight[lp_player])) || (CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lp_behavior, "DisplayPriority", c_playerAny) > CatalogFieldValueGetAsInt(c_gameCatalogBehavior, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayerRight[lp_player], "DisplayPriority", c_playerAny)))) {
        if ((libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayerRight[lp_player] != "") && (UnitBehaviorDurationTotal(lv_heroUnit, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayerRight[lp_player]) > 0.0) && (CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lp_behavior, "DisplayPriority", c_playerAny) < CatalogFieldValueGetAsInt(c_gameCatalogBehavior, libUIUI_gv_heroConsoleUnitStatusBars_BehaviorChannelBarCurrentBehaviorForPlayerRight[lp_player], "DisplayPriority", c_playerAny))) {
            return ;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/UILib.galaxy:6356

    }
    else {
        if ((UnitBehaviorDurationTotal(lp_killedUnit, "Dead") > 0.0)) {
            DialogControlSetVisible(libUIUI_gv_uIPartyFrame.lv_heroDeathTimeOverlay[lv_rosterSlot], PlayerGroupAll(), true);
            lv_deathTimer = libUIUI_gf_UIPartyFrameDeathTimer(lp_killedPlayer, lp_killedUnit);

mods/heroesmapmods/battlegroundmapmods/towersofdoom.stormmodbase.stormdata/LibMTOD.galaxy:2413

    libNtve_gf_SendActorMessageToUnit(EventUnit(), "Signal PlayMorph");
    if ((UnitHasBehavior2(EventUnit(), "StructureOwnershipChangeRepairBehavior") == true)) {
        lv_repairBehaviorElapsed = (UnitBehaviorDurationTotal(EventUnit(), "StructureOwnershipChangeRepairBehavior") - UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior"));
        lv_repairBehaviorRemaining = UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior");
        if ((lv_repairBehaviorRemaining <= 0.125)) {

mods/heroesmapmods/battlegroundmapmods/towersofdoom.stormmodbase.stormdata/LibMTOD.galaxy:2515


    if ((UnitHasBehavior2(EventUnit(), "StructureOwnershipChangeRepairBehavior") == true)) {
        lv_repairBehaviorElapsed = (UnitBehaviorDurationTotal(EventUnit(), "StructureOwnershipChangeRepairBehavior") - UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior"));
        lv_repairBehaviorRemaining = UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior");
        if ((lv_repairBehaviorRemaining <= 0.125)) {

mods/heroesmapmods/battlegroundmapmods/towersofdoom.stormmodbase.stormdata/LibMTOD.galaxy:2573


    if ((UnitHasBehavior2(EventUnit(), "StructureOwnershipChangeRepairBehavior") == true)) {
        lv_repairBehaviorElapsed = (UnitBehaviorDurationTotal(EventUnit(), "StructureOwnershipChangeRepairBehavior") - UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior"));
        lv_repairBehaviorRemaining = UnitBehaviorDuration(EventUnit(), "StructureOwnershipChangeRepairBehavior");
        if ((lv_repairBehaviorRemaining <= 0.125)) {

mods/heromods/ana.stormmodbase.stormdata/LibHANA.galaxy:175


    if (((lv_sleepUnit == libGame_gv_players[lv_sleepPlayer].lv_heroUnit) || (lv_sleepUnit == libGame_gv_players[lv_sleepPlayer].lv_activeVehicle))) {
        libUIUI_gf_FullscreenOverlaysCreateCCEffectFlashForPlayer(lv_sleepPlayer, UnitBehaviorDurationTotal(lv_sleepUnit, lv_sleepBehavior));
    }
    else {

mods/heromods/dva.stormmodbase.stormdata/LibHDVA.galaxy:372

    if ((UnitHasBehavior2(lv_dVaPilotUnit, "DVaPilotDisableCallMech") == true)) {
        lv_dVaMechUnit = UnitBehaviorEffectUnit(lv_dVaPilotUnit, "DVaPilotDisableCallMech", c_effectUnitCaster, 0);
        lv_durationMax = UnitBehaviorDurationTotal(lv_dVaMechUnit, "DVaMechCallMechDisabler");
        lv_durationRemain = UnitBehaviorDuration(lv_dVaMechUnit, "DVaMechCallMechDisabler");
        if ((lv_durationRemain > 0.05)) {

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

        }

        if (!((UnitBehaviorDurationTotal(lv_zeratul, "MalthaelTormentedSoulsBuff") > 0.0))) {
            return false;
        }

mods/heromods/zarya.stormmodbase.stormdata/LibHZAR.galaxy:494

    }

    lv_duration = UnitBehaviorDurationTotal(UnitBehaviorEffectUnit(lv_stunnedUnit, "ZaryaGravitonSurgePull", c_effectUnitCaster, 0), "ZaryaGravitonSurgeCasterDuration");
    lv_durationRemaining = UnitBehaviorDuration(UnitBehaviorEffectUnit(lv_stunnedUnit, "ZaryaGravitonSurgePull", c_effectUnitCaster, 0), "ZaryaGravitonSurgeCasterDuration");
    if ((lv_durationRemaining <= 0.0)) {

mods/heromods/zarya.stormmodbase.stormdata/LibHZAR.galaxy:537

    }

    lv_duration = UnitBehaviorDurationTotal(UnitBehaviorEffectUnit(lv_stunnedUnit, "ZaryaGravitonSurgePull", c_effectUnitCaster, 0), "ZaryaGravitonSurgeCasterDuration");
    lv_durationRemaining = UnitBehaviorDuration(UnitBehaviorEffectUnit(lv_stunnedUnit, "ZaryaGravitonSurgePull", c_effectUnitCaster, 0), "ZaryaGravitonSurgeCasterDuration");
    if ((lv_durationRemaining <= 0.0)) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:16617

    }

    UnitBehaviorAddCooldown(lv_u, libCOMI_gv_cM_DehakaMutaliskReviveCooldownIndicator, "Behavior/PrimalReconstitutionCooldownIndicator", UnitBehaviorDurationTotal(lv_u, lv_behavior));
    return true;
}

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:25085

    lv_unit = EventUnit();
    lv_behavior = EventUnitBehavior();
    lv_cooldown = UnitBehaviorDurationTotal(lv_unit, lv_behavior);

    // Actions

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:28100

    UnitBehaviorAdd(lv_darkTemplar, "ZeratulDarkTemplarRetreatCooldown", lv_darkTemplar, 1);
    UnitBehaviorAdd(lv_darkTemplar, "ZeratulDarkTemplarRetreatRegen", lv_darkTemplar, 1);
    UnitBehaviorAddCooldown(lv_darkTemplar, "ZeratulDarkTemplarRetreatCooldownDisplay", "Behavior/ZeratulDarkTemplarRetreatCooldownDisplay", UnitBehaviorDurationTotal(lv_darkTemplar, "ZeratulDarkTemplarRetreatCooldown"));
    return true;
}