# Set Player Race
Grammar — Set Player player’s race to race.
Flags —Native
|Action
Sets the race of the specified player.
# Arguments
int
— Playerstring
<gamelink::Race> — Race
Returns — void
native void PlayerSetRace(int inPlayer, string inRace);
# Related
Category: Player / Player Settings
- Modify Player Property (Integer) —
void
— PlayerModifyPropertyInt - Modify Player Property (Real) —
void
— PlayerModifyPropertyFixed - Player Property (Integer) —
int
— PlayerGetPropertyInt - Player Property (Real) —
fixed
— PlayerGetPropertyFixed - Modify Player Score (Integer) —
void
— PlayerScoreValueSetFromInt - Modify Player Score (Real) —
void
— PlayerScoreValueSetFromFixed - Player Score Value (Integer) —
int
— PlayerScoreValueGetAsInt - Player Score Value (Real) —
fixed
— PlayerScoreValueGetAsFixed - Turn Player Flag On/Off —
void
— PlayerSetState - Player Flag Check —
bool
— PlayerGetState - Player License Check —
bool
— PlayerHasLicense - Player Access Check —
bool
— PlayerHasAccessTo - Player Has Reward —
bool
— PlayerHasReward - Player Has Talent —
bool
— PlayerHasTalent - Name Of Player —
text
— PlayerName - Handle Of Player —
string
— PlayerHandle - Race Of Player —
string
<gamelink::Race> — PlayerRace - Hero Of Player —
string
<gamelink::Hero> — PlayerHero - Skin Of Player —
string
<gamelink::Skin> — PlayerSkin - Mount Of Player —
string
<gamelink::Mount> — PlayerMount - Spray Of Player —
string
<gamelink::Spray> — PlayerSpray - Artifact Of Player —
string
<gamelink::Artifact> — PlayerArtifact - Artifact Rank Of Player —
int
— PlayerArtifactRank - Commander Of Player —
string
<gamelink::Commander> — PlayerCommander - Commander Level Of Player —
int
— PlayerCommanderLevel - Commander Mastery Level Of Player —
int
— PlayerCommanderMasteryLevel - Commander Mastery Talent Rank Of Player —
int
— PlayerCommanderMasteryTalentRank - Commander Selected Prestige Of Player —
int
— PlayerCommanderSelectedPrestige - Brutal Plus Difficulty of Player —
int
— PlayerBrutalPlusDifficulty - Retry Mutation Index of Player —
int
— PlayerRetryMutation - Allied Commander Enemy Wave Type —
int
— PlayerACEnemyWaveType - Start Location Of Player —
point
— PlayerStartLocation - Controller Of Player —
int
<preset::PlayerController> — PlayerType - Status Of Player —
int
<preset::PlayerStatus> — PlayerStatus - Set Player Color —
void
— PlayerSetColorIndex - Set Player Race —
void
— PlayerSetRace - Set Player Hero —
void
— PlayerSetHero - Set Player Skin —
void
— PlayerSetSkin - Set Player Console Skin —
void
— PlayerSetConsoleSkin - Apply Player Skin —
void
— PlayerApplySkin - Apply Player Skin (Replacing Existing Unit) —
void
— libNtve_gf_PlayerApplySkinReplacingExistingUnit - Set Player Mount —
void
— PlayerSetMount - Set Player Spray —
void
— PlayerSetSpray - Set Player Commander —
void
— PlayerSetCommander - Set Player Commander Level —
void
— PlayerSetCommanderLevel - Set Player Commander Mastery Level —
void
— PlayerSetCommanderMasteryLevel - Set Player Death Timer —
void
— PlayerSetDeathTimer - Set Player Bounds —
void
— PlayerSetBounds - Add Player Talent —
void
— PlayerAddTalent - Remove Player Talent —
void
— PlayerRemoveTalent - Add Player Response —
void
— PlayerAddResponse - Remove Player Response —
void
— PlayerRemoveResponse - Clear Player Response —
void
— PlayerClearResponse - Player Color —
int
<playercolor> — PlayerGetColorIndex - Override Player Option —
void
— PlayerOptionOverride - Player Hotkey Profile —
string
— PlayerGetHotkeyProfile - Player Property Changed —
void
— TriggerAddEventPlayerPropChange - Player Joins Game —
void
— TriggerAddEventPlayerJoin - Player Leaves Game —
void
— TriggerAddEventPlayerLeft - Triggering Player —
int
— EventPlayer - Triggering Player Property —
int
<preset::Player_Property_Get> — EventPlayerProperty - Triggering Player Property Change (Integer) —
int
— EventPlayerPropertyChangeInt - Triggering Player Property Change (Real) —
fixed
— EventPlayerPropertyChangeFixed - Player Add Label —
void
— PlayerAddLabel - Player Remove Label —
void
— PlayerRemoveLabel - Player Remove All Labels —
void
— PlayerRemoveAllLabels - Player Has Label —
bool
— PlayerHasLabel - Player Add Reward —
void
— PlayerAddReward
# Examples
campaigns/void.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.sc2campaign — base.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.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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.sc2campaign/base.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/voidstory.sc2campaign — base.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.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:6923
}
else if (auto4EEECEDA_val == "SC2Epilogue01") {
PlayerSetRace(1, "Terr");
Wait(0.1, c_timeGame);
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:1417
TriggerEnable(libVCUI_gt_PU_ArchivesCloseClicked, true);
if ((PlayerRace(1) != "Prot")) {
PlayerSetRace(1, "Prot");
}
campaigns/voidstory.sc2campaign — base.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.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:7627
}
PlayerSetRace(1, "Zerg");
DialogCreate(1620, 1220, c_anchorCenter, 0, 0, true);
DialogSetFullscreen(DialogLastCreated(), true);
mods/starcoop/starcoop.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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;