# Expand

Grammar — Instruct the AI for player player to expand starting the search at point point and building building at the new expansion
FlagsNative | Function

Instructs the AI for a player to expand starting the search at the specified point, and builds the specified building at the new expansion. Returns the town index for the new town.

# Arguments

  • int — Player
  • point — Point
  • string<gamelink::Unit> — Building

Returns — int

native int AIExpand(
	int player,
	point searchStart,
	string firstBuilding,
);

Category: AI Advanced / Towns / Functions

# Examples

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:451


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:593


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:735


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

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


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }