# AINearbyUnits

FlagsNative

# Arguments

  • int — player
  • string — unitType
  • point — p
  • fixed — range
  • int — requiredCount

Returns — bool

native bool AINearbyUnits(
	int player,
	string unitType,
	point p,
	fixed range,
	int requiredCount,
);

Category: Unclassified

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:200


    here = UnitGetPosition(aiUnit);
    if (AINearbyUnits(player, c_PU_VoidRay, here, 10, 1)) {
        AICast(aiUnit, ord, c_noMarker, c_castHold);
        return true;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:204

        return true;
    }
    if (AINearbyUnits(player, c_PU_Colossus, here, 10, 1)) {
        ord = AICreateOrder(player, c_AB_Hallucinate_Colossus, 0);
        if (UnitOrderIsValid(aiUnit, ord)) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:211

        }
    }
    if (AINearbyUnits(player, c_PU_Archon, here, 10, 1)) {
        ord = AICreateOrder(player, c_AB_Hallucinate_Archon, 0);
        if (UnitOrderIsValid(aiUnit, ord)) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:218

        }
    }
    if (AINearbyUnits(player, c_PU_Immortal, here, 10, 1)) {
        targetGroupGround = UnitGroupFilterPlane(scanGroup, c_planeGround, 0);
        onGround = UnitGroupCount(targetGroupGround, c_unitCountAll);

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:888


    //  Check to see if we already have a changeling.
    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:889

    //  Check to see if we already have a changeling.
    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:890

    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:891

        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:892

        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1097


    //  Check to see if we already have a changeling.
    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1098

    //  Check to see if we already have a changeling.
    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1099

    if (AINearbyUnits(player, c_ZU_Changeling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1100

        AINearbyUnits(player, c_ZU_ChangelingZealot, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1101

        AINearbyUnits(player, c_ZU_ChangelingZergling, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingMarine, here, range, 1) ||
        AINearbyUnits(player, c_ZU_ChangelingZerglingWings, here, range, 1)) {
        return null;
    }