# Duration Of Behavior On Unit
Grammar — Get behavior duration on unit unit
Flags —Native
|Function
Gets a behavior duration on a unit.
# Arguments
unit
— Unitstring
<gamelink::Behavior> — Behavior
Returns — fixed
native fixed UnitBehaviorDurationTotal(
unit inUnit,
string behavior,
);
# 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/heroesdata.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:11525
}
UnitBehaviorSetDuration(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDurationTotal(lv_eTC, "L90ETCMoshPitChannel"));
UnitBehaviorSetDurationRemaining(lv_stunnedUnit, "L90ETCMoshPitDisplayBehavior", UnitBehaviorDuration(lv_eTC, "L90ETCMoshPitChannel"));
}
mods/heroesdata.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:20153
}
lv_duration = UnitBehaviorDurationTotal(lv_triggeringUnit, EventUnitBehavior());
if ((lv_duration > 10.0)) {
lv_duration = 10.0;
mods/heroesdata.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.stormdata/LibHMTH.galaxy:302
}
if (!((UnitBehaviorDurationTotal(lv_zeratul, "MalthaelTormentedSoulsBuff") > 0.0))) {
return false;
}
mods/heromods/zarya.stormmod — base.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.stormmod — base.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.sc2mod — base.sc2data/LibCOMI.galaxy:16617
}
UnitBehaviorAddCooldown(lv_u, libCOMI_gv_cM_DehakaMutaliskReviveCooldownIndicator, "Behavior/PrimalReconstitutionCooldownIndicator", UnitBehaviorDurationTotal(lv_u, lv_behavior));
return true;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:25085
lv_unit = EventUnit();
lv_behavior = EventUnitBehavior();
lv_cooldown = UnitBehaviorDurationTotal(lv_unit, lv_behavior);
// Actions
mods/starcoop/starcoop.sc2mod — base.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;
}