# Set Player Difficulty Level

Grammar — Set player player difficulty level to difficultyLevel
FlagsNative | Action

Sets the difficulty level for the specified player.

# Arguments

  • int — Player
  • int<difficulty> — Difficulty Level

Returns — void

native void PlayerSetDifficulty(
	int inPlayer,
	int inDifficulty,
);

Category: Player / Difficulty Levels

# Examples

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

        autoF0CFB556_var = PlayerGroupNextPlayer(autoF0CFB556_g, autoF0CFB556_var);
        if (autoF0CFB556_var < 0) { break; }
        PlayerSetDifficulty(autoF0CFB556_var, 4);
        AISetAPM(autoF0CFB556_var, 3000);
        TechTreeUpgradeAddLevel(autoF0CFB556_var, "ExtendedThermalLance", 1);

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

        autoF0CFB556_var = PlayerGroupNextPlayer(autoF0CFB556_g, autoF0CFB556_var);
        if (autoF0CFB556_var < 0) { break; }
        PlayerSetDifficulty(autoF0CFB556_var, 4);
        AISetAPM(autoF0CFB556_var, 3000);
        TechTreeUpgradeAddLevel(autoF0CFB556_var, "ExtendedThermalLance", 1);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignStoryLib.galaxy:5469

    }

    PlayerSetDifficulty(1, libVCUI_gf_PU_MissionSelectedDifficulty());
    libVoiC_gf_CinematicFade(false, 0.3, Color(0.00, 0.00, 0.00), true);
    libVCST_gf_EnterRoom(libVCST_ge_Rooms_StoryRoomArmyUpgrade);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignStoryLib.galaxy:5492

    }

    PlayerSetDifficulty(1, libVCUI_gf_PU_MissionSelectedDifficulty());
    libVoiC_gf_CinematicFade(false, 0.3, Color(0.00, 0.00, 0.00), true);
    libVCST_gf_EnterRoom(libVCST_ge_Rooms_StoryRoomShipUpgrade);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:7868


    TriggerEnable(libVCUI_gt_PU_MissionQuitOKClicked, false);
    PlayerSetDifficulty(1, libVCUI_gf_PU_MissionSelectedDifficulty());
    libVCUI_gf_PU_MissionRemoveAliasedUnits();
    libVoiC_gf_DispatchCampaignEvent(libVoiC_ge_PC_Event_UIMissionQuit, "", "", false);

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNCUI.galaxy:5703


    TriggerEnable(libNCUI_gt_NU_MissionQuitOKClicked, false);
    PlayerSetDifficulty(1, libNCUI_gf_NU_MissionSelectedDifficulty());
    libComC_gf_CC_EventDispatch(libNovC_ge_NC_Event_UIMissionQuit, "", "", false);
    return true;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:1090

    lv_aIPlayerRace = libCOOC_gf_CC_AIPersonalityRace(lp_aICommander);
    PlayerSetRace(lp_player, lv_aIPlayerRace);
    PlayerSetDifficulty(lp_player, libCOMI_gf_GetMissionDifficulty());
    PlayerGroupAdd(libCOMI_gv_cM_CoopAI_Players, lp_player);
    libCOMI_gv_cM_CoopAIPlayer_InstantAttackGroupSpawn[lp_player] = PlayerStartLocation(lp_player);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:12346

    libLbty_gf_EnableDisablePingPanel(true, PlayerGroupAll());
    if ((libCOOC_gf_CC_DifficultyIndex(PlayerDifficulty(3)) != 0)) {
        PlayerSetDifficulty(1, PlayerDifficulty(3));
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:12350


    if ((libCOOC_gf_CC_DifficultyIndex(PlayerDifficulty(4)) != 0)) {
        PlayerSetDifficulty(2, PlayerDifficulty(4));
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:4629

        if (lv_indexPlayer < 0) { break; }
        if ((PlayerType(lv_indexPlayer) == c_playerTypeNone)) {
            PlayerSetDifficulty(lv_indexPlayer, 2);
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:4698

        if (lv_indexPlayer < 0) { break; }
        if ((PlayerType(lv_indexPlayer) == c_playerTypeNone)) {
            PlayerSetDifficulty(lv_indexPlayer, 2);
        }