Thank you!The location depends on the Scenario (since several of them came with the big G&K or BNW DLC).
Anyhow, this is the location of the Mongol Scenario (or well, for the lua for it at least, which is what's important for you): C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization V\Assets\DLC\DLC_01. (this Scenario seems to be the most appropriate)
I've peeked a quick look into the lua and this is what I found (CivsAlive.lua):
Where you lose if you run out of time, and you win if you destroy a specific number of civs.Code:function TestVictory() -- Game over? local iRemainingToDestroy, iTurnsRemaining = GetVictoryValues(); if (iRemainingToDestroy < 1) then Game.SetWinner(Game.GetActiveTeam(), GameInfo.Victories["VICTORY_DOMINATION"].ID); GameEvents.GameCoreTestVictory.Remove(TestVictory); elseif (iTurnsRemaining < 1) then Game.SetGameState(GameplayGameStateTypes.GAMESTATE_OVER); GameEvents.GameCoreTestVictory.Remove(TestVictory); end end GameEvents.GameCoreTestVictory.Add(TestVictory);
Good Luck
I have checked through the scenarios, but all of them are based on victory conditions as opposed to failure conditions. I.e. I don't know how to push the other player to win when the current active civ has met the failure condition. The next best thing I can think of is using GetMilitaryMight == 0 code that you've mentioned and make it so that if the active player meets that condition, it's eliminated from play. Then using another loop to check total alive civs, and if that number is 1, i.e. only civ left, then declare the active civ a victory. However, I can't for the life of me find how to put the lua together.
Here's what I have so far:
Code:
function GetVictoryValues()
local iNumPlayersLeft = 0;
local iTurnsRemaining = 100 - Game.GetGameTurn();
-- Loop through all the Majors
for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
if (Players[iPlayerLoop]:IsAlive()) then
iNumPlayersLeft = iNumPlayersLeft + 1;
end
end
end
function CheckMilitarySize(iPlayer)
local pPlayer = Players[iPlayer];
if pPlayer:GetMilitaryMight() == 0 then
--push the victory condition for the other player here
Game.SetGameState(GameplayGameStateTypes.GAMESTATE_OVER);
GameEvents.GameCoreTestVictory.Remove(TestVictory);
end
end
GameEvents.PlayerDoTurn.Add(CheckMilitarySize)
function TestVictory()
-- Game over?
local iNumPlayersLeft, iTurnsRemaining = GetVictoryValues();
if (iNumPlayersLeft == 1) then
Game.SetWinner(Game.GetActiveTeam(), GameInfo.Victories["VICTORY_DOMINATION"].ID);
GameEvents.GameCoreTestVictory.Remove(TestVictory);
elseif (iTurnsRemaining < 1) then
Game.SetGameState(GameplayGameStateTypes.GAMESTATE_OVER);
GameEvents.GameCoreTestVictory.Remove(TestVictory);
end
end
GameEvents.GameCoreTestVictory.Add(TestVictory);