Resource; No Micro - HWRM/KarosGraveyard GitHub Wiki
A no micro mod. You lose control of all of your attacking ships - so make sure to set up your forces the way you want them! Just download to your /data/leveldata/multiplayer directory, and access it via the skirmish screen.
-- LuaDC version 0.9.19
-- 5/23/2004 11:21:45 PM
-- LuaDC by Age2uN
-- on error send source file (compiled lua) and this outputfile to [email protected]
--
GUID =
{ 110, 91, 157, 190, 18, 23, 250, 78, 144, 20, 41, 246, 181, 128, 214, 12, }
GameRulesName = "No Micro"
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")
Events = {}
Events.endGame =
{
{
{ "wID = Wait_Start(5)", "Wait_End(wID)", },
},
}
function OnInit()
MPRestrict()
Rule_Add("MainRule")
Rule_AddInterval("UnSelectRule",15)
end
--updates the "AllShips" sobgroup to cover all the ships in the current universe
function Update_AllShips()
local playerIndex = 0
local playerCount = Universe_PlayerCount()
SobGroup_Create("AllShips")
SobGroup_Clear("AllShips")
while playerIndex<playerCount do
SobGroup_SobGroupAdd("AllShips","Player_Ships"..playerIndex)
playerIndex = playerIndex + 1
end
end
function SobGroup_SplitGroup(SobGroupOut, SobGroupToSplit, NumberToSplit)
-- function created by Apollyon470
local index = 0
local distance = 0
local bool = 0
local SobNum = 0
SobGroup_Create("TempSobGroup")
SobGroup_Clear ("TempSobGroup")
SobGroup_Create("TempSobGroup1")
SobGroup_Clear ("TempSobGroup1")
SobGroup_SobGroupAdd ("TempSobGroup", SobGroupToSplit)
if ( SobGroup_Empty (SobGroupToSplit) == 1 ) then
return 0
end
if ( NumberToSplit > SobGroup_Count(SobGroupToSplit) ) then
NumberToSplit = SobGroup_Count(SobGroupToSplit)
end
while (index < NumberToSplit ) do
bool = 0 -- in the interests of resource saving, we start with a search band of 625
interval = 625
while (bool == 0) do
distance = distance + interval -- something went wrong. Please tell me, or have a go at fixing it yourself.
if (interval > 3000000) then
bool =1
return SobNum
end
SobGroup_FillProximitySobGroup ("TempSobGroup1", "TempSobGroup", SobGroupToSplit, distance)
if (SobGroup_Empty("TempSobGroup1") == 1)then
-- get the next interval
else
if (SobGroup_Count("TempSobGroup1") > 1) then -- too many ships, reduce interval
if (interval == 1) then -- Screw it! chunk 'em all in the same sobgroup
SobGroup_Create(SobGroupOut .. tostring(SobNum))
SobGroup_Clear (SobGroupOut .. tostring(SobNum))
SobGroup_SobGroupAdd (SobGroupOut .. tostring(SobNum), "TempSobGroup1")
SobGroup_Create("tempsob")
SobGroup_FillSubstract("tempsob", "TempSobGroup", SobGroupOut .. tostring(SobNum))
SobGroup_Clear ("TempSobGroup")
SobGroup_SobGroupAdd ("TempSobGroup", "tempsob")
bool = 1
else
distance = distance - interval
interval = interval / 5
end
else -- we got one! add it to the list!
SobGroup_Create(SobGroupOut .. tostring(SobNum))
SobGroup_Clear (SobGroupOut .. tostring(SobNum))
SobGroup_SobGroupAdd (SobGroupOut .. tostring(SobNum), "TempSobGroup1")
SobGroup_Create("tempsob")
SobGroup_FillSubstract("tempsob", "TempSobGroup", SobGroupOut .. tostring(SobNum))
SobGroup_Clear ("TempSobGroup")
SobGroup_SobGroupAdd ("TempSobGroup", "tempsob")
bool = 1
end
end
end
index = index + SobGroup_Count(SobGroupOut .. tostring(SobNum))
SobNum = SobNum + 1
end
return SobNum
end
function Update_Attacking()
local playerIndex=0
playerCount = Universe_PlayerCount()
while playerIndex<playerCount do
SobGroup_Create("Attacking"..playerIndex)
SobGroup_Clear("Attacking"..playerIndex)
playerIndex = playerIndex + 1
end
Update_AllShips()
local Num = SobGroup_SplitGroup("AttackingTemp", "AllShips", SobGroup_Count("AllShips"))
local i=0
while (i<Num) do
if (SobGroup_IsDoingAbility("AttackingTemp"..i,AB_Attack) ==1)then
SobGroup_SobGroupAdd("Attacking"..SobGroup_OwnedBy("AttackingTemp"..i),"AttackingTemp"..i)
end
i=i+1
end
end
function UnSelectRule()
Update_Attacking()
local playerIndex=0
playerCount = Universe_PlayerCount()
while playerIndex<playerCount do
SobGroup_MakeSelectable("Attacking"..playerIndex,0)
playerIndex = playerIndex + 1
end
end
function MainRule()
local playerIndex = 0
local playerCount = Universe_PlayerCount()
while playerIndex<playerCount do
if Player_IsAlive(playerIndex)==1 then
if Player_HasShipWithBuildQueue(playerIndex)==0 then
Player_Kill(playerIndex)
end
end
playerIndex = (playerIndex + 1)
end
local numAlive = 0
local numEnemies = 0
local gameOver = 1
playerIndex = 0
while playerIndex<playerCount do
if Player_IsAlive(playerIndex)==1 then
local otherPlayerIndex = 0
while otherPlayerIndex<playerCount do
if AreAllied(playerIndex, otherPlayerIndex)==0 then
if Player_IsAlive(otherPlayerIndex)==1 then
gameOver = 0
else
numEnemies = (numEnemies + 1)
end
end
otherPlayerIndex = (otherPlayerIndex + 1)
end
numAlive = (numAlive + 1)
end
playerIndex = (playerIndex + 1)
end
if numEnemies==0 and numAlive>0 then
gameOver = 0
end
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