Skip to content
Permalink
Browse files

DAI: fixed random spawn

  • Loading branch information...
Damgam committed Sep 10, 2019
1 parent a05890b commit 5cb53eaeac08e763e2aced08620c20a161b22030
Showing with 2 additions and 8 deletions.
  1. +2 −8 LuaRules/Gadgets/game_spawn.lua
@@ -87,20 +87,14 @@ local function GetStartUnit(teamID)
if IsTeamAI(teamID) then
Spring.Echo ("Enemy is an AI so it gets an AI Specific Overseer!")
--local factionrandom = math.random(0,1)
math.random(); math.random(); math.random()
local sidedata = factionDefComms[math.random(0,1)]
if sidedata == nil then
Spring.Echo("faction: nil")
else
Spring.Echo("faction: " .. sidedata)
end

math.random(); math.random(); math.random()

if not sidedata then
local factionIndex = math.random(0, 1)
sidedata = factionDefComms[factionIndex]
end

local aiCommData = aiStartUnits[sidedata] or {}
local aiCommIndex = math.random(1, #aiCommData)
startUnit = aiCommData[aiCommIndex]
@@ -122,7 +116,7 @@ local function SpawnStartUnit(teamID)
if (startUnit and startUnit ~= "") then
-- spawn the specified start unit
local x,y,z = Spring.GetTeamStartPosition(teamID)
if boolIsAI==true then
if IsTeamAI(teamID) then
local _,_,_,_,_,allyID = Spring.GetTeamInfo(teamID)
local startBoxXmin, startBoxZmin, startBoxXmax, startBoxZmax = Spring.GetAllyTeamStartBox(allyID)
local mx = Game.mapSizeX

0 comments on commit 5cb53ea

Please sign in to comment.
You can’t perform that action at this time.