# Set Player Commander

Grammar — Set Player player’s commander to commander.
FlagsNative | Action

Sets the commander of the specified player.

# Arguments

  • int — Player
  • string<gamelink::Commander> — Commander

Returns — void

native void PlayerSetCommander(
	int inPlayer,
	string inCommander,
);

Category: Player / Player Settings

# Examples

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


    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:4433

    // Implementation
    if ((libCOOC_gf_GameIsContestLocalTest() == true)) {
        PlayerSetCommander(1, UserDataGetGameLink("PlayerCommanders", lv_commander1, "CommanderData", 1));
        libCOOC_gf_CC_PlayerCommanderSet(1, lv_commander1);
        PlayerSetRace(1, libCOOC_gf_CC_CommanderRace(lv_commander1));

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

        libCOOC_gf_CC_PlayerCommanderSet(1, lv_commander1);
        PlayerSetRace(1, libCOOC_gf_CC_CommanderRace(lv_commander1));
        PlayerSetCommander(2, UserDataGetGameLink("PlayerCommanders", lv_commander2, "CommanderData", 1));
        libCOOC_gf_CC_PlayerCommanderSet(2, lv_commander2);
        PlayerSetRace(2, libCOOC_gf_CC_CommanderRace(lv_commander2));

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:2071


    libNtve_gf_SetUpgradeLevelForPlayer(lv_itIndex, "WarcraftCommander", 1);
    PlayerSetCommander(lp_player, lv_commander);
    TechTreeUpgradeAddLevel(lp_player, "WarcraftCommander", 1);
    TechTreeSetProduceCap(lp_player, "_CoopHero", c_techCatUnit, 1);