# Known Unit Count

Grammar — Get the number of units of type unitType owned by player otherPlayer that have been seen by the specified player player
FlagsNative | Function

Returns the number of units of of the specified unit type owned by another player that have been seen by the specified player.

# Arguments

  • int — Player
  • int — OtherPlayer
  • string<gamelink::Unit> — UnitType

Returns — int

native int AIKnownUnitCount(
	int player,
	int testPlayerId,
	string aliasUnitType,
);

Category: AI Advanced / Construction / Functions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:453


    if (time < 240) {
        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:454

    if (time < 240) {
        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:455

        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {
            return true;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:456

            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {
            return true;
        }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:461


        if (time < 140) {
            if (AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 2 ||
                AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 2) {
                return true;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:462

        if (time < 140) {
            if (AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 2 ||
                AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 2) {
                return true;
            }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:467


            if (time < 105) {
                if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpawningPool) > 0) {
                    return true;
                }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:515

    }

    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:516


    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)
    {

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:517

    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)
    {
        return true;

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:453


    if (time < 180) {
        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:454

    if (time < 180) {
        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:455

        if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_RoachWarren) > 0 ||
            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {
            return true;

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:456

            AIKnownUnitCount(player, c_maxPlayers, c_ZB_BanelingNest) > 0 ||            
            AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 3 ||
            AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 3) {
            return true;
        }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:461


        if (time < 105) {
            if (AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 2 ||
                AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 2) {
                return true;

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:462

        if (time < 105) {
            if (AIKnownUnitCount(player, c_maxPlayers, c_PB_Gateway) >= 2 ||
                AIKnownUnitCount(player, c_maxPlayers, c_TB_Barracks) >= 2) {
                return true;
            }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:467


            if (time < 75) {
                if (AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpawningPool) > 0) {
                    return true;
                }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:515

    }

    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:516


    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)
    {

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:517

    if (AIKnownUnitCount(player, c_maxPlayers, c_TB_Bunker) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_PB_PhotonCannon) > 0 ||
        AIKnownUnitCount(player, c_maxPlayers, c_ZB_SpineCrawler) > 0)
    {
        return true;