# Weapon Range

Grammar — Range of unit weapon weapon
FlagsNative | Function

Returns a unit’s weapon range.

# Arguments

  • unit — Unit
  • int — Weapon

Returns — fixed

native fixed UnitWeaponRange(unit inUnit, int inIndex);

Category: Unit / Weapons

# Examples

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/AILib.galaxy:2206

    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/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:433

	}
	ord = AICreateOrder(player, "Aatk", 0);
	range=UnitWeaponRange(aiUnit,1);
	AIWeaponGroup(player, weapon, scanGroup);
    filter = AIFilter(player);