On certain GameEvents, I want to check whether the player's civilization is my mod-sponsor in order to give that player (whether it's me or if it's AI) some bonuses, so I use this code:
if GameInfoTypes["CIVILIZATION_MY_SPONSOR"] == player:GetCivilizationType() then
-- give bonus here
end
Sometimes, GameInfoTypes["CIVILIZATION_MY_SPONSOR"] is nil - I don't know why. So far, it happens when I first load CivBE and set up a game where I pick that sponsor as me. Printing to FireTuner shows nil.
The funny thing is, I will need to quit that current game to Main Menu, set up a game picking that same sponsor again, and voila - GameInfoTypes["CIVILIZATION_MY_SPONSOR"] is no longer nil, but the expected value.
What could I be doing wrong?
if GameInfoTypes["CIVILIZATION_MY_SPONSOR"] == player:GetCivilizationType() then
-- give bonus here
end
Sometimes, GameInfoTypes["CIVILIZATION_MY_SPONSOR"] is nil - I don't know why. So far, it happens when I first load CivBE and set up a game where I pick that sponsor as me. Printing to FireTuner shows nil.
The funny thing is, I will need to quit that current game to Main Menu, set up a game picking that same sponsor again, and voila - GameInfoTypes["CIVILIZATION_MY_SPONSOR"] is no longer nil, but the expected value.
What could I be doing wrong?