function OnModGameStart_Player_color_changer()
Game.playercolorchanger = true --enables mod referencing
--if Game.factionselection == true then return 0 end --if factions are enabled terminate this script
QuickInformation(26, "...COLOR CHANGER INITIALISED... \nSwitch colors from the research menu Pg2.")
MagicAvailable("ALL_PLAYERS","PLAYER_COLOR_CHANGER",true,true)
end
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
local player_color_changer = 0
function Player_color_changer(player,power_kind,power_level,stl_x,stl_y,thing,is_free)
player_color_changer = player_color_changer + 1 --print(player_color_changer)

if player_color_changer == 1 then
ClearMessage(1) QuickMessage("Blue",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,RED)")
end
if player_color_changer == 2 then
ClearMessage(1) QuickMessage("Green",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,BLUE)")
end
if player_color_changer == 3 then
ClearMessage(1) QuickMessage("Yellow",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,GREEN)")
end
if player_color_changer == 4 then
ClearMessage(1) QuickMessage("White",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,YELLOW)")
end
if player_color_changer == 5 then
ClearMessage(1) QuickMessage("Purple",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,WHITE)")
end
if player_color_changer == 6 then
ClearMessage(1) QuickMessage("Black",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,PURPLE)")
end
if player_color_changer == 7 then
ClearMessage(1) QuickMessage("Orange",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,ORANGE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,BLACK)")
end
if player_color_changer == 8 then
ClearMessage(1) QuickMessage("Red",0)
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER0,RED)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER1,BLUE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER2,GREEN)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER3,YELLOW)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER4,WHITE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER5,PURPLE)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER6,BLACK)")
RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,ORANGE)") --if PLAYER8.HEART_HEALTH<0 then RunDKScriptCommand("SET_PLAYER_COLOR(PLAYER_GOOD,RED)") end --4
player_color_changer = 0
end

return 0
end