# Weapon Cooldown Remaining

Grammar — Remaining cooldown of unit weapon weapon
FlagsNative | Function

Returns a unit’s remaining weapon cooldown.

# Arguments

  • unit — Unit
  • int — Weapon

Returns — fixed

native fixed UnitWeaponPeriodRemaining(
	unit inUnit,
	int inIndex,
);

Category: Unit / Weapons

# Examples

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/AILib.galaxy:650

    lv_currentOrderTarget = OrderGetTargetUnit(UnitOrder(lv_creepUnit, 0));
    libAIAI_gv_defenderAICreepNeedsNewOrder = true;
    if ((UnitWeaponPeriodRemaining(lv_creepUnit, 1) > 2.0)) {
        libAIAI_gv_defenderAICreepNeedsNewOrder = false;
    }

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


    auto5EA1B378_at = 0;
    while (!((UnitWeaponPeriodRemaining(lv_unit, 2) == 0.0)) && auto5EA1B378_at <= 3.0) {
        Wait(0.0625, c_timeGame);
        auto5EA1B378_at = auto5EA1B378_at + 0.0625;