TofuSojo
Chieftain
I have a scenario which is set to 1500 max turns in World Builder (it seems you have to set it to some number, it won't let me leave it blank and just go by the game speed the player chooses).
The following lua function runs and changes the number of max turns but for some reason it always thinks Standard speed has been chosen:
That is to say, const_iGameSpeed is always being set to 2 (Standard speed). Originally I had this hooked into SequenceGameInitComplete (with the same results), but I thought maybe that event happens before the scenario setup screen (even though that would be crazy, because then no one could ever change the game speed in any game, scenario or not, modded or not).
Any idea why it always thinks the speed is set to Standard?? Note, it is actually changing the max number of turns from my scenario default of 1500 to 500 (standard speed), so it's not like it's not running or ultimately doing what it is supposed to do, just not correctly.
Any help would be much appreciated!
The following lua function runs and changes the number of max turns but for some reason it always thinks Standard speed has been chosen:
Code:
function ChangeMaxTurns()
print("ChangeMaxTurns running...")
local const_iGameSpeed = Game.GetGameSpeedType() --GameInfo.GameSpeeds[]
local iNumMaxTurns
print("const_iGameSpeed: " .. const_iGameSpeed)
if const_iGameSpeed == 0 then
print("Marathon speed detected. Setting max game turns to 1500...")
iNumMaxTurns = 1500
elseif const_iGameSpeed == 1 then
print("Epic speed detected. Setting max game turns to 750...")
iNumMaxTurns = 750
elseif const_iGameSpeed == 2 then
print("Standard speed detected. Setting max game turns to 500...")
iNumMaxTurns = 500
elseif const_iGameSpeed == 3 then
print("Quick speed detected. Setting max game turns to 350...")
iNumMaxTurns = 350
end
if iNumMaxTurns == nil then
print("iNumMaxTurns is nil! Aborting...")
else
Game.SetMaxTurns(iNumMaxTurns)
end
end
Events.LoadScreenClose.Add(ChangeMaxTurns)
That is to say, const_iGameSpeed is always being set to 2 (Standard speed). Originally I had this hooked into SequenceGameInitComplete (with the same results), but I thought maybe that event happens before the scenario setup screen (even though that would be crazy, because then no one could ever change the game speed in any game, scenario or not, modded or not).
Any idea why it always thinks the speed is set to Standard?? Note, it is actually changing the max number of turns from my scenario default of 1500 to 500 (standard speed), so it's not like it's not running or ultimately doing what it is supposed to do, just not correctly.
Any help would be much appreciated!