# Weapon Cooldown Remaining
Grammar — Remaining cooldown of unit weapon weapon
Flags —Native
|Function
Returns a unit’s remaining weapon cooldown.
# Arguments
unit
— Unitint
— Weapon
Returns — fixed
native fixed UnitWeaponPeriodRemaining(
unit inUnit,
int inIndex,
);
# Related
Category: Unit / Weapons
- Remove Weapon From Unit —
void
— UnitWeaponRemove - Add Weapon To Unit —
void
— UnitWeaponAdd - Number Of Weapons On Unit —
int
— UnitWeaponCount - Unit Weapon —
string
<gamelink::Weapon> — UnitWeaponGet - Weapon Is Enabled —
bool
— UnitWeaponIsEnabled - Weapon Target Check —
bool
— UnitWeaponCheck - Weapon Cooldown —
fixed
— UnitWeaponPeriod - Weapon Range —
fixed
— UnitWeaponRange - Weapon Cooldown Remaining —
fixed
— UnitWeaponPeriodRemaining - Add Ammo To Magazine —
void
— UnitMagazineArm - Last Created Magazine Ammo Unit —
unit
— UnitMagazineLastCreated - Last Created Magazine Ammo Units —
unitgroup
— UnitMagazineLastCreatedGroup - Magazine Count Of Unit —
int
— UnitMagazineCount - Magazine Owner Of Unit —
unit
— UnitGetMagazine - Unit Can Attack Unit Old —
bool
— libNtve_gf_UnitCanAttackUnit - Unit Can Attack Unit Type —
bool
— UnitCanAttackTarget - Unit In Range And Able To Attack Target —
bool
— UnitInRangeAndAbleToAttackTarget - Weapon Damage —
fixed
— UnitWeaponDamage - Weapon Speed Multiplier —
fixed
— UnitWeaponSpeedMultiplier - Set Weapon Cooldown Remaining —
void
— UnitWeaponSetPeriodRemaining
# Examples
mods/heroesdata.stormmod — base.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.stormmod — base.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;