# Get Difficulty Parameter

Grammar — Get the state of difficulty parameter index for player player
FlagsNative | Function

Returns the state of a particular difficulty parameter for a player.

# Arguments

Returns — bool

native bool AIGetDifficulty(int player, int index);

Category: AI Advanced / Difficulty / Functions

# Examples

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

    int evalRatio = AIEvalRatio(player);

    if (AIGetDifficulty(player, c_diffNormalVision) != true) {
        // if cheating vision, this eval is accurate
        if (evalRatio > 110) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:859

            autoLoad = true;
        }
        else if (AIGetDifficulty(player, c_diffAutoLoadBunkers)) {
            autoLoad = true;
        }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1761

    onGroundCount = UnitGroupCount(targetGroupGround, c_unitCountAll);
    
    if (!AIGetDifficulty(player, c_diffSpotChangelings)) {
        while (onGroundCount > 0) {
            maybeChangeling = UnitGroupUnit(targetGroupGround, onGroundCount);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:830

    if (UnitGroupCount(targetGroup, c_unitCountAlive) == 0) { // no nearby enemies.
        
        if (AIGetDifficulty(player, c_diffAutoLoadBunkers)) {
            autoLoad = true;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1715

    onGroundCount = UnitGroupCount(targetGroupGround, c_unitCountAll);
    
    if (AIGetDifficulty(player, c_diffSpotChangelings)) {
        while (onGroundCount > 0) {
            maybeChangeling = UnitGroupUnit(targetGroupGround, onGroundCount);

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

    int evalRatio = AIEvalRatio(player);

    if (AIGetDifficulty(player, c_diffNormalVision) != true) {
        // if cheating vision, this eval is accurate
        if (evalRatio > 110) {