# Weapon Is Enabled
Grammar — unit weapon weapon is enabled
Flags —Native
|Function
Returns true if a weapon is enabled for a unit.
# Arguments
unit
— Unitint
— Weapon
Returns — bool
native bool UnitWeaponIsEnabled(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/core.sc2mod — base.sc2data/TriggerLibs/NativeLib.galaxy:5760
for ( ; ( (auto761381D2_ai >= 0 && lv_weapon <= auto761381D2_ae) || (auto761381D2_ai < 0 && lv_weapon >= auto761381D2_ae) ) ; lv_weapon += auto761381D2_ai ) {
lv_weaponFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogWeapon, UnitWeaponGet(lp_u, lv_weapon), "TargetFilters", UnitGetOwner(lp_u)));
if ((UnitWeaponIsEnabled(lp_u, lv_weapon) == true) && (UnitFilterMatch(lp_s, UnitGetOwner(lp_u), lv_weaponFilter) == true)) {
return true;
}
mods/core.stormmod — base.stormdata/TriggerLibs/NativeLib.galaxy:4898
for ( ; ( (auto761381D2_ai >= 0 && lv_weapon <= auto761381D2_ae) || (auto761381D2_ai < 0 && lv_weapon >= auto761381D2_ae) ) ; lv_weapon += auto761381D2_ai ) {
lv_weaponFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogWeapon, UnitWeaponGet(lp_u, lv_weapon), "TargetFilters", UnitGetOwner(lp_u)));
if ((UnitWeaponIsEnabled(lp_u, lv_weapon) == true) && (UnitFilterMatch(lp_s, UnitGetOwner(lp_u), lv_weaponFilter) == true)) {
return true;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/AILib.galaxy:2205
lv_weaponIndex = 1;
for ( ; ( (autoEDA1BD1C_ai >= 0 && lv_weaponIndex <= autoEDA1BD1C_ae) || (autoEDA1BD1C_ai < 0 && lv_weaponIndex >= autoEDA1BD1C_ae) ) ; lv_weaponIndex += autoEDA1BD1C_ai ) {
if ((UnitWeaponIsEnabled(lp_unit, lv_weaponIndex) == true) && (UnitWeaponRange(lp_unit, lv_weaponIndex) > lv_bestRange)) {
lv_bestRange = UnitWeaponRange(lp_unit, lv_weaponIndex);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2538
lv_itWeapon = 1;
for ( ; ( (auto91D56C1A_ai >= 0 && lv_itWeapon <= auto91D56C1A_ae) || (auto91D56C1A_ai < 0 && lv_itWeapon >= auto91D56C1A_ae) ) ; lv_itWeapon += auto91D56C1A_ai ) {
if ((UnitWeaponGet(lp_unit, lv_itWeapon) != null) && (UnitWeaponIsEnabled(lp_unit, lv_itWeapon) == true)) {
return UnitWeaponDamage(lp_unit, lv_itWeapon, c_unitAttributeNone, false);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2560
lv_itWeapon = 1;
for ( ; ( (auto3CC89007_ai >= 0 && lv_itWeapon <= auto3CC89007_ae) || (auto3CC89007_ai < 0 && lv_itWeapon >= auto3CC89007_ae) ) ; lv_itWeapon += auto3CC89007_ai ) {
if ((UnitWeaponGet(lp_unit, lv_itWeapon) != null) && (UnitWeaponIsEnabled(lp_unit, lv_itWeapon) == true)) {
return UnitWeaponSpeedMultiplier(lp_unit, lv_itWeapon);
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:237
for ( ; ( (auto05DEC010_ai >= 0 && lv_itWeaponIndex <= auto05DEC010_ae) || (auto05DEC010_ai < 0 && lv_itWeaponIndex >= auto05DEC010_ae) ) ; lv_itWeaponIndex += auto05DEC010_ai ) {
lv_itWeapon = UnitWeaponGet(lv_itUnit, lv_itWeaponIndex);
if ((UnitWeaponIsEnabled(lv_itUnit, lv_itWeaponIndex) == true) && (libGAw3_gf_GAw3_WeaponAtkType(lv_itWeapon) == "Pierce")) {
if ((lv_canDefend == true)) {
libNtve_gf_AICast(lp_aIUnit, lv_cmd);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:302
for ( ; ( (auto35BE4688_ai >= 0 && lv_itWeaponIndex <= auto35BE4688_ae) || (auto35BE4688_ai < 0 && lv_itWeaponIndex >= auto35BE4688_ae) ) ; lv_itWeaponIndex += auto35BE4688_ai ) {
lv_itWeapon = UnitWeaponGet(lv_itUnit, lv_itWeaponIndex);
if ((UnitWeaponIsEnabled(lv_itUnit, lv_itWeaponIndex) == true) && (libGAw3_gf_GAw3_WeaponAtkType(lv_itWeapon) == "Magic")) {
if ((lv_canDefend == true)) {
libNtve_gf_AICast(lp_aIUnit, lv_cmd);