Here's a working, decompiled (and slightly edited) "Deathmatch.lua" for your reference, since the one decompiled from "
Homeworld2.big" doesn't work.
GUID =
{ 110, 91, 157, 190, 18, 23, 250, 78, 144, 20, 41, 246, 181, 128, 214, 12, }
GameRulesName = "$3203"
Description = "$3230"
GameSetupOptions =
{
{
name = "resources",
locName = "$3240",
tooltip = "$3239",
default = 1,
visible = 1,
choices =
{ "$3241", "0.5", "$3242", "1.0", "$3243", "2.0", },
},
{
name = "unitcaps",
locName = "$3214",
tooltip = "$3234",
default = 1,
visible = 1,
choices =
{ "$3215", "Small", "$3216", "Normal", "$3217", "Large", },
},
{
name = "resstart",
locName = "$3205",
tooltip = "$3232",
default = 0,
visible = 1,
choices =
{ "$3206", "1000", "$3207", "3000", "$3208", "10000", "$3209", "0", },
},
{
name = "lockteams",
locName = "$3220",
tooltip = "$3235",
default = 0,
visible = 1,
choices =
{ "$3221", "yes", "$3222", "no", },
},
{
name = "startlocation",
locName = "$3225",
tooltip = "$3237",
default = 0,
visible = 1,
choices =
{ "$3226", "random", "$3227", "fixed", },
},
}
dofilepath("data:scripts\\scar\\restrict.lua")
function OnInit()
MPRestrict()
-- changed this from 'Rule_Add' to 'RuleAdd_Interval' to speed the game up -Mikail
Rule_AddInterval("MainRule", 1)
end
-------------------------------------------------------------------------------
-- main rule to call for this game type
--
function MainRule()
local PlayerCount = Universe_PlayerCount() - 1
local numAlive = 0
local numEnemies = 0
local gameOver = 1
-- check to see if ALL of our enemies are dead, then gameOver
for playerIndex = 0, PlayerCount do
if (Player_IsAlive(playerIndex) == 1) then
-- kill the player if the player has no production capability
if (Player_HasShipWithBuildQueue(playerIndex) == 0) then
Player_Kill(playerIndex)
-- else, only process 'alive' players
else
-- compare this player against all others
for otherPlayerIndex = 0, PlayerCount do
-- are enemies?
if (AreAllied(playerIndex, otherPlayerIndex) == 0) then
-- is the enemy alive - if so the game is still on
if (Player_IsAlive(otherPlayerIndex) == 1) then
gameOver = 0
else
numEnemies = numEnemies + 1
end
end
end
numAlive = numAlive + 1
end
end
end
-- special case: if there are no enemies, then never end
if ((numEnemies == 0) and (numAlive > 0)) then
gameOver = 0
end
-- if gameOver flag is still set then the game is OVER
if (gameOver == 1) then
Rule_Add("waitForEnd")
Event_Start("endGame")
Rule_Remove("MainRule")
end
end
function waitForEnd()
if (Event_IsDone("endGame")) then
setGameOver()
Rule_Remove("waitForEnd")
end
end
-- EVENTS Create the events table. The name of this table must always be 'Events' because this is what the game looks for.
Events =
{
endGame =
{
{
{"wID = Wait_Start(5)", "Wait_End(wID)"},
},
},
}