# Set Player Race

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

Sets the race of the specified player.

# Arguments

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

Returns — void

native void PlayerSetRace(int inPlayer, string inRace);

Category: Player / Player Settings

# Examples

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:846

    autoCCD08B04_val = gv_tutorialProgress;
    if (autoCCD08B04_val == 1) {
        PlayerSetRace(gv_p01_USER, "Terr");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_terr.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:858

    }
    else if (autoCCD08B04_val == 2) {
        PlayerSetRace(gv_p01_USER, "Zerg");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_zerg.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:870

    }
    else if (autoCCD08B04_val == 3) {
        PlayerSetRace(gv_p01_USER, "Prot");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_prot.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:882

    }
    else if (autoCCD08B04_val == 4) {
        PlayerSetRace(gv_p01_USER, "Prot");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_prot.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:894

    }
    else {
        PlayerSetRace(gv_p01_USER, "Terr");
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[2], PlayerGroupAll(), false);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:2855

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Terr");
        TriggerExecute(gt_BasicInitialization, true, false);
    }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:2861

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Terr");
        TriggerExecute(gt_TerranInitialization, true, false);
    }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:2867

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Zerg");
        TriggerExecute(gt_ZergInitialization, true, false);
    }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:2873

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Prot");
        TriggerExecute(gt_ProtossInitialization, true, false);
    }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/sc2epilogue02.sc2map/MapScript.galaxy:8025

    CameraApplyInfo(gv_pLAYER_01_USER, CameraInfoFromId(282), 0.0, -1, 10, true);
    CameraApplyInfo(gv_pLAYER_01_USER, CameraInfoFromId(1350), (SoundLengthSync(SoundLink(ConversationDataGetSound("Mission_Epilogue02|Line00045", true), c_soundIndexAny)) + 1.0), -1, 10, true);
    PlayerSetRace(gv_pLAYER_01_USER, "Terr");
    Wait(0.0625, c_timeGame);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/sc2epilogue02.sc2map/MapScript.galaxy:8188

    GameTimeOfDayPause(false);
    PlayerSetState(gv_pLAYER_01_USER, c_playerStateXPGain, true);
    PlayerSetRace(gv_pLAYER_01_USER, "Terr");
    Wait(0.0625, c_timeGame);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:846

    autoCCD08B04_val = gv_tutorialProgress;
    if (autoCCD08B04_val == 1) {
        PlayerSetRace(gv_p01_USER, "Terr");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_terr.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:858

    }
    else if (autoCCD08B04_val == 2) {
        PlayerSetRace(gv_p01_USER, "Zerg");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_zerg.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:870

    }
    else if (autoCCD08B04_val == 3) {
        PlayerSetRace(gv_p01_USER, "Prot");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_prot.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:882

    }
    else if (autoCCD08B04_val == 4) {
        PlayerSetRace(gv_p01_USER, "Prot");
        libNtve_gf_SetDialogItemImage(gv_victoryUI_BackgroundImage, "Assets\\Textures\\ui_ingame_tutorial_bg_prot.dds", PlayerGroupAll());
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:894

    }
    else {
        PlayerSetRace(gv_p01_USER, "Terr");
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[1], PlayerGroupAll(), true);
        DialogControlSetEnabled(gv_victoryUI_StageSelectButtons[2], PlayerGroupAll(), false);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:2855

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Terr");
        TriggerExecute(gt_BasicInitialization, true, false);
    }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:2861

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Terr");
        TriggerExecute(gt_TerranInitialization, true, false);
    }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:2867

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Zerg");
        TriggerExecute(gt_ZergInitialization, true, false);
    }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2mapMapScript.galaxy:2873

        DialogSetVisible(gv_victoryUI, PlayerGroupAll(), false);
        UISetMode(PlayerGroupAll(), c_uiModeConsole, c_transitionDurationImmediate);
        PlayerSetRace(gv_p01_USER, "Prot");
        TriggerExecute(gt_ProtossInitialization, true, false);
    }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/sc2epilogue02.sc2mapMapScript.galaxy:8025

    CameraApplyInfo(gv_pLAYER_01_USER, CameraInfoFromId(282), 0.0, -1, 10, true);
    CameraApplyInfo(gv_pLAYER_01_USER, CameraInfoFromId(1350), (SoundLengthSync(SoundLink(ConversationDataGetSound("Mission_Epilogue02|Line00045", true), c_soundIndexAny)) + 1.0), -1, 10, true);
    PlayerSetRace(gv_pLAYER_01_USER, "Terr");
    Wait(0.0625, c_timeGame);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/sc2epilogue02.sc2mapMapScript.galaxy:8188

    GameTimeOfDayPause(false);
    PlayerSetState(gv_pLAYER_01_USER, c_playerStateXPGain, true);
    PlayerSetRace(gv_pLAYER_01_USER, "Terr");
    Wait(0.0625, c_timeGame);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:1456

    UISetWorldVisible(PlayerGroupAll(), false);
    libVCUI_gf_SetHeroPanelUnit(1, null);
    PlayerSetRace(1, "Prot");
    libNtve_gf_HideGameUI(false, PlayerGroupAll());
    libVCUI_gf_PU_GPVisibilityAutoUpdate(false, c_transitionDurationImmediate);

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:6923

    }
    else if (auto4EEECEDA_val == "SC2Epilogue01") {
        PlayerSetRace(1, "Terr");
        Wait(0.1, c_timeGame);
    }

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:1417

    TriggerEnable(libVCUI_gt_PU_ArchivesCloseClicked, true);
    if ((PlayerRace(1) != "Prot")) {
        PlayerSetRace(1, "Prot");
    }

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:1690

    // Implementation
    if ((PlayerRace(1) != "Terr")) {
        PlayerSetRace(1, "Terr");
        Wait(0.1, c_timeGame);
        if ((libVoiC_gf_StoryInSimulation() == true)) {

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:7627

    }

    PlayerSetRace(1, "Zerg");
    DialogCreate(1620, 1220, c_anchorCenter, 0, 0, true);
    DialogSetFullscreen(DialogLastCreated(), true);

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

        lv_aIPlayerRace = (CatalogFieldValueGet(c_gameCatalogUnit, UserDataGetUnit("CoopAICommanderTiers", UserDataGetUserInstance("CoopAICommanders", libCOMI_gv_cM_CoopAIPlayer_CommanderShared, "UnitTiers", 1), "PhaseUnits", 1), "Race", lp_player));
    }
    PlayerSetRace(lp_player, lv_aIPlayerRace);
    AICampaignStart(lp_player);
    VisRevealArea(lp_player, RegionEntireMap(), 0.1, false);

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

    libCOMI_gv_cM_CoopAIPlayer_Commander[lp_player] = lp_aICommander;
    lv_aIPlayerRace = libCOOC_gf_CC_AIPersonalityRace(lp_aICommander);
    PlayerSetRace(lp_player, lv_aIPlayerRace);
    PlayerSetDifficulty(lp_player, libCOMI_gf_GetMissionDifficulty());
    PlayerGroupAdd(libCOMI_gv_cM_CoopAI_Players, lp_player);

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

        PlayerSetCommander(1, UserDataGetGameLink("PlayerCommanders", lv_commander1, "CommanderData", 1));
        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);

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

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

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

    libCOOC_gf_CC_PlayerCommanderSet(lp_player, lv_chosenCommander);
    if ((PlayerRace(lp_player) != libCOOC_gf_CC_CommanderRace(lv_chosenCommander))) {
        PlayerSetRace(lp_player, libCOOC_gf_CC_CommanderRace(lv_chosenCommander));
    }

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

    if ((libCOOC_gf_CoopDebugModeIsOn("CustomMutators", 1) == true)) {
        libCOOC_gf_CC_PlayerCommanderSet(1, "TerranRaynor");
        PlayerSetRace(1, libCOOC_gf_CC_CommanderRace("TerranRaynor"));
        libCOOC_gf_CC_PlayerCommanderSet(2, "ZergKerrigan");
        PlayerSetRace(2, libCOOC_gf_CC_CommanderRace("ZergKerrigan"));

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

        PlayerSetRace(1, libCOOC_gf_CC_CommanderRace("TerranRaynor"));
        libCOOC_gf_CC_PlayerCommanderSet(2, "ZergKerrigan");
        PlayerSetRace(2, libCOOC_gf_CC_CommanderRace("ZergKerrigan"));
        autoD84D30F6_g = libCOOC_gf_HumanPlayers();
        lv_indexPlayer = -1;

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

    // Implementation
    libCOOC_gf_CC_PlayerCommanderSet(lp_player, libCOUI_gv_cU_CommanderSelection[lp_player]);
    PlayerSetRace(lp_player, libCOOC_gf_CC_CommanderRace(libCOUI_gv_cU_CommanderSelection[lp_player]));
    libCOOC_gf_CC_PlayerMasteryEnabledSet(lp_player, libNtve_gf_DialogItemIsChecked(libCOUI_gv_cU_CommanderMasteryCheckbox, lp_player));
    libCOOC_gf_CC_UpdateTechStates(lp_player);

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

        if (lv_player < 0) { break; }
        lv_race = UserDataGetGameLink("PlayableLegends", libWCdr_gf_GetLegendInstanceForPlayer(lv_player), "Race", 1);
        PlayerSetRace(lv_player, lv_race);
        lv_playerProp = c_playerPropMinerals;
        lv_i = 0;