# Set State

Grammar — Sets the state at index index for player player to state state
FlagsNative | 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 — Player
  • int — Index
  • int — State

Returns — void

native void AISetSpecificState(
	int player,
	int index,
	int state,
);

Category: AI Advanced / Utility / Actions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:190

    int oldState = AIState(player, e_attackState);

    AISetSpecificState(player, e_attackState, attackState);
    
    if (DEBUG_ATTACK_STATE) {

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:207

    int oldSubState = AIState(player, e_mainSubState);

    AISetSpecificState(player, e_mainState, mainState);
    AISetSpecificState(player, e_mainSubState, mainSubState);

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:208


    AISetSpecificState(player, e_mainState, mainState);
    AISetSpecificState(player, e_mainSubState, mainSubState);

    if (DEBUG_MAIN_STATE) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:190

    int oldState = AIState(player, e_attackState);

    AISetSpecificState(player, e_attackState, attackState);
    
    if (DEBUG_ATTACK_STATE) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:207

    int oldSubState = AIState(player, e_mainSubState);

    AISetSpecificState(player, e_mainState, mainState);
    AISetSpecificState(player, e_mainSubState, mainSubState);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:208


    AISetSpecificState(player, e_mainState, mainState);
    AISetSpecificState(player, e_mainSubState, mainSubState);

    if (DEBUG_MAIN_STATE) {