[Lua] PreGame.GetCivilizationColor();

Hello.

According to the little bot that will create the new wiki, it's a player ID (the index in the Players table).

This player_ID is strange. For player's color is easier to use
Code:
local color = pPlayer:GetPlayerColor();
but how to get color for civilization if I have for example civ.ID?
I have tried to use civ.DefaultColor in
Code:
PreGame.SetPlayerColor(player_ID,color);
but it dosen't work. Result is: Wrong argumnet type.

How to get civ color?
 
@Nefliqus
PreGame was made to change the settings before the game start and at this time player:GetColor is not possible.

Now, if you want the favorite color of a civ, then you need to look at the XML data (GameInfo.PlayerColors ?). But the game may actually use a different color choice if there was some conflict between two civs.

Also, be careful: some colors are strings that related to the RGBA values defined in XML while others are tables with four fieds (r, g, b, a).
 
@Nefliqus
PreGame was made to change the settings before the game start and at this time player:GetColor is not possible.

Now, if you want the favorite color of a civ, then you need to look at the XML data (GameInfo.PlayerColors ?). But the game may actually use a different color choice if there was some conflict between two civs.

Also, be careful: some colors are strings that related to the RGBA values defined in XML while others are tables with four fieds (r, g, b, a).

so I will need some SQL query to logical connect civ and color id, yes?
 
Well, you could do that but if you prefer you can also do it with regular Lua constructs.
Something like (probably won't work as it is, I didn't check the data tables):

Code:
local color = GameInfo.PlayerColors{CivilizationType = player:GetCivilizationType()}.Color
 
Well, you could do that but if you prefer you can also do it with regular Lua constructs.
Something like (probably won't work as it is, I didn't check the data tables):

Code:
local color = GameInfo.PlayerColors{CivilizationType = player:GetCivilizationType()}.Color

kiszok.gif
thank you
 
Back
Top Bottom