# Set State
Grammar — Sets the state at index index for player player to state state
Flags —Native
|Action
Sets the value of the specified state index for a player. The state is a per player integer array that can be useful to AI scripting.
# Arguments
int
— Playerint
— Indexint
— State
Returns — void
native void AISetSpecificState(
int player,
int index,
int state,
);
# Related
Category: AI Advanced / Utility / Actions
- Start AI —
void
— AIStart - Accept Surrender —
void
— AIGoodGame - Init Melee AI —
void
— AIMeleeStart - Set APM —
void
— AISetAPM - Release Unit —
void
— AIReleaseUnit - Set State —
void
— AISetSpecificState - Set All States —
void
— AISetAllStates - Set Flag —
void
— AISetFlag - Set Coop Flag —
void
— AISetCoopFlag - Set Tech Flag State —
void
— AITechFlag - Set Unit Evaluation Custom Index —
void
— AIEvalSetCustomIndex - Enable/Disable AI Option For Unit —
void
— UnitSetAIOption - Set Defense Radii —
void
— AISetDefenseRadii
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:190
int oldState = AIState(player, e_attackState);
AISetSpecificState(player, e_attackState, attackState);
if (DEBUG_ATTACK_STATE) {
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:207
int oldSubState = AIState(player, e_mainSubState);
AISetSpecificState(player, e_mainState, mainState);
AISetSpecificState(player, e_mainSubState, mainSubState);
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:208
AISetSpecificState(player, e_mainState, mainState);
AISetSpecificState(player, e_mainSubState, mainSubState);
if (DEBUG_MAIN_STATE) {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:190
int oldState = AIState(player, e_attackState);
AISetSpecificState(player, e_attackState, attackState);
if (DEBUG_ATTACK_STATE) {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:207
int oldSubState = AIState(player, e_mainSubState);
AISetSpecificState(player, e_mainState, mainState);
AISetSpecificState(player, e_mainSubState, mainSubState);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:208
AISetSpecificState(player, e_mainState, mainState);
AISetSpecificState(player, e_mainSubState, mainSubState);
if (DEBUG_MAIN_STATE) {