how is the number of major civs set?

primordial stew

Emperor
Joined
Sep 1, 2005
Messages
1,219
Location
a puddle
Basically, I'm only using the first 8 slots, but the game is auto-magically adding 2 more civs. How to keep it from doing this?

What is also annoying is that the auto-magic civs are "alive", but not set to anything, so trying "pPlayer:GetCivilizationDescriptionKey()" for them is a FATAL error at this point.

I can't find something like: PreGame.SetNumMinorCivs for full civs. In FoRScenarioLoadScreen.lua there are only 8 civs, but it loads a map and that is where the civs are set. I'm also loading a map, but it only has terrain. There are no civs set in it. The problem with setting up civs in the map is that if anything changes (a civ is added or deleted) it breaks the intended settings, so I'm trying to avoid that if possible.

Code:
local ROME_ID = 0
PreGame.SetSlotStatus(0, SlotStatus.SS_TAKEN);
PreGame.SetCivilization(0, GameInfo.Civilizations["CIVILIZATION_BYZANTIUM"].ID);
PreGame.SetPlayerColor(0, GameInfo.PlayerColors["PLAYERCOLOR_BYZANTIUM"].ID); 
PreGame.SetLeaderType(0, GameInfo.Leaders["LEADER_THEODORA"].ID); 
local ALANS_ID = 1
PreGame.SetSlotStatus(1, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(1, GameInfo.Civilizations["CIVILIZATION_SARMATIA"].ID);
PreGame.SetPlayerColor(1, GameInfo.PlayerColors["PLAYERCOLOR_PUNT"].ID); 
PreGame.SetLeaderType(1, GameInfo.Leaders["LEADER_CADMUS"].ID); 
local BURGUNDIAN_ID = 2
PreGame.SetSlotStatus(2, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(2, GameInfo.Civilizations["CIVILIZATION_CARTHAGE"].ID);
PreGame.SetPlayerColor(2, GameInfo.PlayerColors["PLAYERCOLOR_CARTHAGE"].ID); 
PreGame.SetLeaderType(2, GameInfo.Leaders["LEADER_DIDO"].ID); 
local FRANKS_ID = 3
PreGame.SetSlotStatus(3, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(3, GameInfo.Civilizations["CIVILIZATION_JUTES"].ID);
PreGame.SetPlayerColor(3, GameInfo.PlayerColors["PLAYERCOLOR_DARK_CYAN_AND_LEMON"].ID); 
PreGame.SetLeaderType(3, GameInfo.Leaders["LEADER_PACAL"].ID); 
local GERMANICS_ID = 4
PreGame.SetSlotStatus(4, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(4, GameInfo.Civilizations["CIVILIZATION_GERMANIC"].ID);
PreGame.SetPlayerColor(4, GameInfo.PlayerColors["PLAYERCOLOR_GERMANICTRIBES"].ID); 
PreGame.SetLeaderType(4, GameInfo.Leaders["LEADER_ARMINIUS"].ID); 
local HUNS_ID = 5
PreGame.SetSlotStatus(5, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(5, GameInfo.Civilizations["CIVILIZATION_HUNS"].ID);
PreGame.SetPlayerColor(5, GameInfo.PlayerColors["PLAYERCOLOR_HUNS"].ID); 
PreGame.SetLeaderType(5, GameInfo.Leaders["LEADER_ATTILA"].ID); 
local PERSIA_ID = 6
PreGame.SetSlotStatus(6, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(6, GameInfo.Civilizations["CIVILIZATION_PERSIA"].ID);
PreGame.SetPlayerColor(6, GameInfo.PlayerColors["PLAYERCOLOR_PERSIA"].ID); 
PreGame.SetLeaderType(6, GameInfo.Leaders["LEADER_DARIUS"].ID); 
local WRE_ID = 7
PreGame.SetSlotStatus(7, SlotStatus.SS_COMPUTER);
PreGame.SetCivilization(7, GameInfo.Civilizations["CIVILIZATION_ROME"].ID);
PreGame.SetPlayerColor(7, GameInfo.PlayerColors["PLAYERCOLOR_ROME"].ID); 
PreGame.SetLeaderType(7, GameInfo.Leaders["LEADER_AUGUSTUS"].ID); 
PreGame.SetSlotStatus(8, SlotStatus.SS_CLOSED);
PreGame.SetSlotStatus(9, SlotStatus.SS_CLOSED);
PreGame.SetSlotStatus(10, SlotStatus.SS_CLOSED);
PreGame.SetNumMinorCivs(0)
print("-I- mapdata: done with pregame")

for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
	local pPlayer = Players[iPlayer];
        -- print("-D- MAX_MAJOR_CIVS - loop: ",iPlayer)
	local slotStatus = PreGame.GetSlotStatus(iPlayer);
        print("-D- MAX_MAJOR_CIVS - loop: ",iPlayer, " slotStatus =",slotStatus)
	if (pPlayer:IsAlive()) then
		-- local civType = pPlayer:GetCivilizationDescriptionKey();   -- FATAL on auto-magic civs
                -- print("-D- MAX_MAJOR_CIVS - isAlive:", iPlayer," ", civType)
		-- local isMinor = pPlayer:IsMinorCiv();
		local isBarbarian = pPlayer:IsBarbarian();
                print("-D- MAX_MAJOR_CIVS - isAlive:", iPlayer, " isBarbarian= ",isBarbarian);
	end
end

Which results in this in the lua.log:

Spoiler :
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 0 slotStatus = 3
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 0 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 1 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 1 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 2 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 2 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 3 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 3 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 4 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 4 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 5 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 5 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 6 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 6 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 7 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 7 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 8 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 8 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 9 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - isAlive: 9 isBarbarian= false
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 10 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 11 slotStatus = 1
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 12 slotStatus = 4
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 13 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 14 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 15 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 16 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 17 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 18 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 19 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 20 slotStatus = 2
[78331.222] battleOfCannae: -D- MAX_MAJOR_CIVS - loop: 21 slotStatus = 2
 
Back
Top Bottom