# Get Difficulty Parameter
Grammar — Get the state of difficulty parameter index for player player
Flags —Native
|Function
Returns the state of a particular difficulty parameter for a player.
# Arguments
int
— Playerint
<preset::AIDifficultyIndex> — Index
Returns — bool
native bool AIGetDifficulty(int player, int index);
# Related
Category: AI Advanced / Difficulty / Functions
- Get Difficulty Parameter —
bool
— AIGetDifficulty
# Examples
mods/core.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:859
autoLoad = true;
}
else if (AIGetDifficulty(player, c_diffAutoLoadBunkers)) {
autoLoad = true;
}
mods/core.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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) {