# Commander Of Player

Grammar — Commander of player p
FlagsNative | Function

Returns the commander of the player.

# Arguments

  • int — Player

Returns — string<gamelink::Commander>

native string PlayerCommander(int inPlayer);

Category: Player / Player Settings

# Examples

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

    lv_i = 1;
    for ( ; ( (auto583267D6_ai >= 0 && lv_i <= auto583267D6_ae) || (auto583267D6_ai < 0 && lv_i >= auto583267D6_ae) ) ; lv_i += auto583267D6_ai ) {
        autoA8B54D99_val = PlayerCommander(lv_i);
        if (autoA8B54D99_val == "Raynor") {
            libCOMI_gv_playerColor[lv_i] = 2;

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

        }

        lv_adjutantRace = UserDataGetGameLink("PlayerCommanders", libCOOC_gf_CC_CommanderUserInstance(PlayerCommander(lv_indexPlayer)), "AdjutantRace", 1);
        auto085E9DF9_val = lv_adjutantRace;
        if (auto085E9DF9_val == "Terr") {

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

        lv_indexPlayer = PlayerGroupNextPlayer(auto698A507A_g, lv_indexPlayer);
        if (lv_indexPlayer < 0) { break; }
        if ((lv_indexPlayer != 15) && (PlayerCommander(lv_indexPlayer) == null)) {
            libNtve_gf_SetAllianceBetweenTwoPlayerGroups(PlayerGroupSingle(lv_indexPlayer), PlayerGroupSingle(15), libNtve_ge_AllianceSetting_Neutral);
            libNtve_gf_SetAllianceBetweenTwoPlayerGroups(PlayerGroupSingle(15), PlayerGroupSingle(lv_indexPlayer), libNtve_ge_AllianceSetting_Neutral);

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

    }

    auto864A12EB_val = PlayerCommander(EventPlayer());
    if (auto864A12EB_val == "Fenix") {
        libNtve_gf_PlayerRemoveCooldown(EventPlayer(), "SOASummonFenix");

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

    }

    if ((PlayerCommander(lv_dyingUnitPlayer) == "Horner")) {
        lv_scrapPlayerDivisor = 5;
    }

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

    // Conditions
    if (testConds) {
        if (!((PlayerCommander(UnitGetOwner(EventUnit())) == "Abathur"))) {
            return false;
        }

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

    // Conditions
    if (testConds) {
        if (!(((UnitGetType(EventUnit()) != "Locust") && (PlayerCommander(lv_killedPlayer) == "Abathur") && ((UnitHasBehavior2(EventUnit(), "BiomassBuff1") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff10") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff100") == true)) && (UnitFilterMatch(EventUnit(), 1, UnitFilter(0, 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), 0)) == true) && ((libNtve_gf_UnitIsHidden(EventUnit()) == false) || (EventUnitDamageEffect() == libCOMI_gv_cM_CargoDeathKillEffect)) && (lv_biomassRefundChance > 0.0)))) {
            return false;
        }

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

    // Conditions
    if (testConds) {
        if (!(((UnitGetType(EventUnit()) != "Locust") && (PlayerCommander(UnitGetOwner(EventUnit())) == "Abathur") && (UnitFilterMatch(EventUnit(), 1, UnitFilter(0, 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterHidden - 32)))) == true)))) {
            return false;
        }

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

    // Conditions
    if (testConds) {
        if (!(((PlayerCommander(UnitGetOwner(EventUnit())) == "Abathur") && ((UnitHasBehavior2(EventUnit(), "BiomassBuff1") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff10") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff100") == true)) && ((libNtve_gf_TriggeringProgressUnitType() == "RavagerAbathur") || (libNtve_gf_TriggeringProgressUnitType() == "GuardianMP") || (libNtve_gf_TriggeringProgressUnitType() == "Devourer"))))) {
            return false;
        }

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

    // Conditions
    if (testConds) {
        if (!(((UnitIsAlive(EventUnit()) == true) && (PlayerCommander(UnitGetOwner(EventUnit())) == "Abathur") && ((UnitHasBehavior2(EventUnit(), "BiomassBuff1") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff10") == true) || (UnitHasBehavior2(EventUnit(), "BiomassBuff100") == true))))) {
            return false;
        }

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

    }

    if ((PlayerCommander(lp_player) != libCOOC_gf_CC_CommanderData(lp_commander))) {
        PlayerSetCommander(lp_player, libCOOC_gf_CC_CommanderData(lp_commander));
    }

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

    else if ((PlayerRace(lp_player) == "Prot") && (libCOOC_gf_ActiveCommanderForPlayer(lp_player) == "ProtossZeratul")) {
    }
    else if ((PlayerRace(lp_player) == "Prot") && (PlayerCommander(lp_player) == "Alarak")) {
        TechTreeAbilityAllow(lp_player, AbilityCommand("ForgeResearch", 17), true);
        TechTreeAbilityAllow(lp_player, AbilityCommand("ForgeResearch", 18), true);

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

    TextExpressionSetToken("Param/Expression/lib_COOC_D5B22955", "A", IntToText(lp_player));
    TextExpressionSetToken("Param/Expression/lib_COOC_D5B22955", "B", PlayerName(lp_player));
    TextExpressionSetToken("Param/Expression/lib_COOC_D5B22955", "C", StringToText((PlayerCommander(lp_player))));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COOC_D5B22955"), false);
    lv_chosenCommander = libCOOC_gf_CC_CommanderUserInstance(PlayerCommander(lp_player));

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

    TextExpressionSetToken("Param/Expression/lib_COOC_D5B22955", "C", StringToText((PlayerCommander(lp_player))));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COOC_D5B22955"), false);
    lv_chosenCommander = libCOOC_gf_CC_CommanderUserInstance(PlayerCommander(lp_player));
    libCOOC_gf_CC_PlayerCommanderSet(lp_player, lv_chosenCommander);
    if ((PlayerRace(lp_player) != libCOOC_gf_CC_CommanderRace(lv_chosenCommander))) {

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

    // Automatic Variable Declarations
    // Implementation
    if ((PlayerCommander(lp_player) != null)) {
        return true;
    }

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

        }

        if (!((PlayerCommander(EventUnitDamageSourcePlayer()) == "Mengsk"))) {
            return false;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:1045


    // Implementation
    if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lp_player) == 0) && (CatalogEntryIsValid(c_gameCatalogCommander, PlayerCommander(lp_player)) == true)) {
        lv_playerPrestigeText = StringExternal(CatalogFieldValueGet(c_gameCatalogCommander, PlayerCommander(lp_player), "Description", c_playerAny));
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:1046

    // Implementation
    if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lp_player) == 0) && (CatalogEntryIsValid(c_gameCatalogCommander, PlayerCommander(lp_player)) == true)) {
        lv_playerPrestigeText = StringExternal(CatalogFieldValueGet(c_gameCatalogCommander, PlayerCommander(lp_player), "Description", c_playerAny));
    }
    else if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lp_player) == 0)) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:1051

        lv_playerPrestigeText = null;
    }
    if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lv_playerAlly) == 0) && (CatalogEntryIsValid(c_gameCatalogCommander, PlayerCommander(lv_playerAlly)) == true)) {
        lv_playerAllyPrestigeText = StringExternal(CatalogFieldValueGet(c_gameCatalogCommander, PlayerCommander(lv_playerAlly), "Description", c_playerAny));
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:1052

    }
    if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lv_playerAlly) == 0) && (CatalogEntryIsValid(c_gameCatalogCommander, PlayerCommander(lv_playerAlly)) == true)) {
        lv_playerAllyPrestigeText = StringExternal(CatalogFieldValueGet(c_gameCatalogCommander, PlayerCommander(lv_playerAlly), "Description", c_playerAny));
    }
    else if ((libCOOC_gf_CC_PlayerActivePrestigeIndex(lv_playerAlly) == 0)) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:1612

    lv_itemIndex = 0;
    for ( ; ( (auto606ADCEC_ai >= 0 && lv_itemIndex <= auto606ADCEC_ae) || (auto606ADCEC_ai < 0 && lv_itemIndex >= auto606ADCEC_ae) ) ; lv_itemIndex += auto606ADCEC_ai ) {
        lv_face = libCOOC_gf_CC_CommanderPrestigeIndexFace(PlayerCommander(lp_player), lv_itemIndex);
        libNtve_gf_SetDialogItemImage(libCOUI_gv_cU_PrestigeSelectors[lv_itemIndex].lv_icon, (CatalogFieldValueGet(c_gameCatalogButton, lv_face, "Icon", c_playerAny)), PlayerGroupSingle(lp_player));
        libNtve_gf_SetDialogItemTooltip(libCOUI_gv_cU_PrestigeSelectors[lv_itemIndex].lv_button, libCOOC_gf_TooltipTextofButton(lp_player, lv_face), PlayerGroupSingle(lp_player));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:2250

    // Automatic Variable Declarations
    // Variable Initialization
    lv_face = libCOOC_gf_CC_CommanderPrestigeIndexFace(PlayerCommander(lp_player), libCOOC_gf_CC_PlayerActivePrestigeIndex(lp_player));

    // Implementation

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:4777

    }

    if ((PlayerCommander(lp_player) == "Tychus")) {
        auto6AE23501_g = UnitGroup("TychusMedivacPlatform", lp_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
        auto6AE23501_u = UnitGroupCount(auto6AE23501_g, c_unitCountAll);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:4790

    }

    if ((PlayerCommander(lp_player) == "Zeratul")) {
        UnitGroupAdd(libCOUI_gv_cU_GPCasterGroupSecondary[lp_player], libCOMI_gv_cM_GlobalCasterUnitSecondary[lp_player]);
        libNtve_gf_SetDialogItemUnitGroup(libCOUI_gv_cU_ZeratulSelectionCmdPanel, libCOUI_gv_cU_GPCasterGroupSecondary[lp_player], PlayerGroupSingle(lp_player));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:4795

    }

    if ((PlayerCommander(lp_player) == "Mengsk")) {
        UnitSetPropertyFixed(lp_casterUnit, c_unitPropEnergy, RoundI(UnitGetPropertyFixed(lp_casterUnit, c_unitPropEnergy, c_unitPropCurrent)));
        libCOMI_gf_CM_Mengsk_EnergyChanged(lp_player);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:4823

    // Variable Initialization
    lv_updatePlayers = PlayerGroupEmpty();
    lv__2DGlobalPanel = UserDataGetInt("PlayerCommanders", libCOOC_gf_CC_CommanderUserInstance(PlayerCommander(lp_player)), "GlobalCast2D", 1);

    // Implementation