# Weapon Is Enabled

Grammarunit weapon weapon is enabled
FlagsNative | Function

Returns true if a weapon is enabled for a unit.

# Arguments

  • unit — Unit
  • int — Weapon

Returns — bool

native bool UnitWeaponIsEnabled(unit inUnit, int inIndex);

Category: Unit / Weapons

# Examples

mods/core.sc2modbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.sc2modbase.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.sc2modbase.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);