# Set APM

Grammar — Set the APM count for player player to aPM
FlagsNative | Action

Limits the actions per minute of a computer player.

# Arguments

  • int — Player
  • int — APM

Returns — void

native void AISetAPM(int player, int apm);

Category: AI Advanced / Utility / Actions

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:3217


    TimerStart(gv_maraudersComeOnline, 60.0, false, c_timeAI);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 10000);
    AIAttackWaveSetGatherPoint(gv_p2_RAYNOR_LIGHTBLUE, PointFromId(432));
    AIAttackWaveSetGatherPoint(gv_p8_ALLIED_PINK, PointFromId(268));

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:3229

    AIAttackWaveSetTargetPlayer(gv_p12_ALLIED_CELLBLOCK_B, PlayerGroupSingle(gv_p3_DOMINION_RED));
    AIToggleBulliesInRegion(gv_p2_RAYNOR_LIGHTBLUE, RegionFromId(12), true);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:3230

    AIToggleBulliesInRegion(gv_p2_RAYNOR_LIGHTBLUE, RegionFromId(12), true);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:3231

    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));
    TriggerExecute(gt_ALLYAttackWavesMainBase, true, false);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:3232

    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));
    TriggerExecute(gt_ALLYAttackWavesMainBase, true, false);
    TriggerExecute(gt_ALLYAttackWaves, true, false);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:1669

    AICampaignStart(gv_pLAYER_ZERG_EAST);
    AICampaignStart(gv_pLAYER_ZERG_SPECIAL);
    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:1670

    AICampaignStart(gv_pLAYER_ZERG_SPECIAL);
    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:1671

    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);
    return true;

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:1672

    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);
    return true;
}

campaigns/liberty.sc2campaignbase.sc2maps/maps/challenges/rushdefense.sc2map/MapScript.galaxy:1201

    AIAttackWaveSetTargetPlayer(gv_p2_ENEMY_ZERG, PlayerGroupSingle(gv_pLAYER_USER));
    AIAttackWaveSetTargetPlayer(gv_p3_ENEMY_PROTOSS, PlayerGroupSingle(gv_pLAYER_USER));
    AISetAPM(gv_p2_ENEMY_ZERG, 3000);
    AISetAPM(gv_p3_ENEMY_PROTOSS, 3000);
    PlayerGroupLoopBegin(gv_allEnemyPlayers);

campaigns/liberty.sc2campaignbase.sc2maps/maps/challenges/rushdefense.sc2map/MapScript.galaxy:1202

    AIAttackWaveSetTargetPlayer(gv_p3_ENEMY_PROTOSS, PlayerGroupSingle(gv_pLAYER_USER));
    AISetAPM(gv_p2_ENEMY_ZERG, 3000);
    AISetAPM(gv_p3_ENEMY_PROTOSS, 3000);
    PlayerGroupLoopBegin(gv_allEnemyPlayers);
    while (!PlayerGroupLoopDone()) {

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:3217


    TimerStart(gv_maraudersComeOnline, 60.0, false, c_timeAI);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 10000);
    AIAttackWaveSetGatherPoint(gv_p2_RAYNOR_LIGHTBLUE, PointFromId(432));
    AIAttackWaveSetGatherPoint(gv_p8_ALLIED_PINK, PointFromId(268));

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:3229

    AIAttackWaveSetTargetPlayer(gv_p12_ALLIED_CELLBLOCK_B, PlayerGroupSingle(gv_p3_DOMINION_RED));
    AIToggleBulliesInRegion(gv_p2_RAYNOR_LIGHTBLUE, RegionFromId(12), true);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:3230

    AIToggleBulliesInRegion(gv_p2_RAYNOR_LIGHTBLUE, RegionFromId(12), true);
    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:3231

    AISetAPM(gv_p2_RAYNOR_LIGHTBLUE, 3000);
    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));
    TriggerExecute(gt_ALLYAttackWavesMainBase, true, false);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:3232

    AISetAPM(gv_p8_ALLIED_PINK, 3000);
    AISetAPM(gv_p9_ALLIED_GREEN, 3000);
    AISetAPM(gv_p3_DOMINION_RED, libNtve_gf_DifficultyValueInt(400, 800, 3000, 3000));
    TriggerExecute(gt_ALLYAttackWavesMainBase, true, false);
    TriggerExecute(gt_ALLYAttackWaves, true, false);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2mapMapScript.galaxy:1669

    AICampaignStart(gv_pLAYER_ZERG_EAST);
    AICampaignStart(gv_pLAYER_ZERG_SPECIAL);
    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2mapMapScript.galaxy:1670

    AICampaignStart(gv_pLAYER_ZERG_SPECIAL);
    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2mapMapScript.galaxy:1671

    AISetAPM(gv_pLAYER_ZERG_MAIN, 9001);
    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);
    return true;

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2mapMapScript.galaxy:1672

    AISetAPM(gv_pLAYER_ZERG_SOUTH, 9001);
    AISetAPM(gv_pLAYER_ZERG_EAST, 9001);
    AISetAPM(gv_pLAYER_ZERG_SPECIAL, 9001);
    return true;
}

campaigns/liberty.sc2campaign/base.sc2maps/maps/challenges/rushdefense.sc2mapMapScript.galaxy:1201

    AIAttackWaveSetTargetPlayer(gv_p2_ENEMY_ZERG, PlayerGroupSingle(gv_pLAYER_USER));
    AIAttackWaveSetTargetPlayer(gv_p3_ENEMY_PROTOSS, PlayerGroupSingle(gv_pLAYER_USER));
    AISetAPM(gv_p2_ENEMY_ZERG, 3000);
    AISetAPM(gv_p3_ENEMY_PROTOSS, 3000);
    PlayerGroupLoopBegin(gv_allEnemyPlayers);

campaigns/liberty.sc2campaign/base.sc2maps/maps/challenges/rushdefense.sc2mapMapScript.galaxy:1202

    AIAttackWaveSetTargetPlayer(gv_p3_ENEMY_PROTOSS, PlayerGroupSingle(gv_pLAYER_USER));
    AISetAPM(gv_p2_ENEMY_ZERG, 3000);
    AISetAPM(gv_p3_ENEMY_PROTOSS, 3000);
    PlayerGroupLoopBegin(gv_allEnemyPlayers);
    while (!PlayerGroupLoopDone()) {

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zchar01.sc2map/MapScript.galaxy:4126


    CampaignInitAI();
    AISetAPM(gv_pLAYER_02_ZERG, 10000);
    TriggerExecute(gt_ZergAttackWaves, true, false);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zkorhal03.sc2map/MapScript.galaxy:4553

    TriggerExecute(gt_CreateDominionPatrolLeftSide, true, false);
    TriggerExecute(gt_RaynorAttackPrepTiming, true, false);
    AISetAPM(gv_PLAYER_07_DOMINION_GREEN22, 10000);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffRepairDamage, true);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zchar01.sc2mapMapScript.galaxy:4126


    CampaignInitAI();
    AISetAPM(gv_pLAYER_02_ZERG, 10000);
    TriggerExecute(gt_ZergAttackWaves, true, false);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zkorhal03.sc2mapMapScript.galaxy:4553

    TriggerExecute(gt_CreateDominionPatrolLeftSide, true, false);
    TriggerExecute(gt_RaynorAttackPrepTiming, true, false);
    AISetAPM(gv_PLAYER_07_DOMINION_GREEN22, 10000);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffRepairDamage, true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:1346

        if (autoF0CFB556_var < 0) { break; }
        PlayerSetDifficulty(autoF0CFB556_var, 4);
        AISetAPM(autoF0CFB556_var, 3000);
        TechTreeUpgradeAddLevel(autoF0CFB556_var, "ExtendedThermalLance", 1);
        if ((TechTreeUpgradeCount(gv_pLAYER_01_USER, "SOASuperShield", c_techCountQueuedOrBetter) >= 1)) {

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pkorhal02.sc2map/MapScript.galaxy:4366

    CampaignInitAI();
    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    AISetAPM(gv_pLAYER_02_DOMINION, 10000);
    AISetAPM(gv_pLAYER_02_DOMINION2, 10000);
    AISetDifficulty(gv_pLAYER_02_DOMINION, c_diffAutoLoadBunkers, true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pkorhal02.sc2map/MapScript.galaxy:4367

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    AISetAPM(gv_pLAYER_02_DOMINION, 10000);
    AISetAPM(gv_pLAYER_02_DOMINION2, 10000);
    AISetDifficulty(gv_pLAYER_02_DOMINION, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_pLAYER_02_DOMINION2, c_diffAutoLoadBunkers, true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2mapMapScript.galaxy:1346

        if (autoF0CFB556_var < 0) { break; }
        PlayerSetDifficulty(autoF0CFB556_var, 4);
        AISetAPM(autoF0CFB556_var, 3000);
        TechTreeUpgradeAddLevel(autoF0CFB556_var, "ExtendedThermalLance", 1);
        if ((TechTreeUpgradeCount(gv_pLAYER_01_USER, "SOASuperShield", c_techCountQueuedOrBetter) >= 1)) {

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pkorhal02.sc2mapMapScript.galaxy:4366

    CampaignInitAI();
    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    AISetAPM(gv_pLAYER_02_DOMINION, 10000);
    AISetAPM(gv_pLAYER_02_DOMINION2, 10000);
    AISetDifficulty(gv_pLAYER_02_DOMINION, c_diffAutoLoadBunkers, true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pkorhal02.sc2mapMapScript.galaxy:4367

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    AISetAPM(gv_pLAYER_02_DOMINION, 10000);
    AISetAPM(gv_pLAYER_02_DOMINION2, 10000);
    AISetDifficulty(gv_pLAYER_02_DOMINION, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_pLAYER_02_DOMINION2, c_diffAutoLoadBunkers, true);

mods/novastoryassets.sc2modbase.sc2maps/maps/campaign/nova/nova03.sc2map/MapScript.galaxy:3017

    AIAttackWaveCancel(cai_getLastWave(gv_pLAYER_04_FERALZERG_RIGHTBULLIES));
    AIAttackWaveCancel(cai_getLastWave(gv_pLAYER_05_FERALZERG_LEFTBULLIES));
    AISetAPM(gv_pLAYER_03_FERALZERG_MIDDLEBULLIES, 3000);
    TriggerEnable(gt_S1BonusObjectiveRevealQ, false);
    TriggerEnable(gt_S1UnitEntersBonusObjectiveRevealQ, false);

mods/novastoryassets.sc2mod/base.sc2maps/maps/campaign/nova/nova03.sc2mapMapScript.galaxy:3017

    AIAttackWaveCancel(cai_getLastWave(gv_pLAYER_04_FERALZERG_RIGHTBULLIES));
    AIAttackWaveCancel(cai_getLastWave(gv_pLAYER_05_FERALZERG_LEFTBULLIES));
    AISetAPM(gv_pLAYER_03_FERALZERG_MIDDLEBULLIES, 3000);
    TriggerEnable(gt_S1BonusObjectiveRevealQ, false);
    TriggerEnable(gt_S1UnitEntersBonusObjectiveRevealQ, false);