First, there is some kind of dis-connect between what the defense structures list shows and what shows up. I am Seraphim, on planet 122 I see 1 T1 PD for Seraphim and 2 T2 Pd for Seraphim. At ABOVE 50% influence, I *DEFEND* the attack (a few minutes ago) and this is the reinforcements list:
- Code: Select all
gwReinforcements = {
transportedUnits = {
{
playerName = "Kathlyn Murders",
delay = 4,
unitNames = {
"UEL0101",
},
},
{
playerName = "Kathlyn Murders",
delay = 60,
unitNames = {
"UEL0103",
"UEL0103",
"UEL0103",
"UEL0103",
},
},
{
playerName = "Jarvis Bielefield",
delay = 56,
unitNames = {
"UEL0103",
"UEL0103",
"UEL0103",
"UEL0103",
},
},
},
initialStructure = {
},
initialUnitWarp = {
},
periodicUnitWarp = {
},
builtByEngineerStructure = {
},
}
As you can see, no initialStructures for me or anybody else. That's a problem.
Second, reinforcements don't show up in a lot of games so I looked at the code and I think I've determined why:
- Code: Select all
assignSupports = function()
local ArmiesList = ScenarioInfo.ArmySetup
for name,army in ScenarioInfo.ArmySetup do
if army.ArmyIndex == 1 then
factions[1] = army.Faction
teams[1] = army.Team
beaconTime[1] = 0
elseif army.ArmyIndex == 2 then
factions[2] = army.Faction
teams[2] = army.Team
beaconTime[2] = 0
end
end
for name,army in ScenarioInfo.ArmySetup do
if army.ArmyName == "SUPPORT_1" then
army.Team = teams[1]
army.Civilian = false
army.ArmyColor = 1
army.PlayerColor= 1
army.Faction = factions[1]
army.PlayerName="gw_support_1"
armySupport[1] = army.ArmyName
armySupportIndex[1] = army.ArmyIndex
army.Support = true
elseif army.ArmyName == "SUPPORT_2" then
army.Team = teams[2]
army.ArmyColor = 2
army.PlayerColor=2
army.Civilian = false
army.Faction = factions[2]
army.PlayerName="gw_support_2"
army.Support = true
armySupport[2] = army.ArmyName
armySupportIndex[2] = army.ArmyIndex
end
end
end
^^If there are more than 2 players in the game, all the players past the first two cannot get reinforcements because they has no support army assigned.
Look at the snippet below:
- Code: Select all
SpawnTransportedReinforcements = function(beacon, unitsToSpawn)
WARN('Spawningtransported Reinforcements')
local NearestOffMapLocation = beacon.NearestOffMapLocation
local UnitsToTransport = {}
UnitsToTransport[1] = {}
UnitsToTransport[2] = {}
UnitsToTransport[3] = {}
local NumberOfTransportsNeeded = 0
#this spawns our units
for index, unitBPid in unitsToSpawn do
#WARN('spawning reinforcement unit bpid is ' .. repr(unitBPid))
#WARN('spawning beacon.ArmyName unit bpid is ' .. repr(beacon.ArmyIndex))
local newUnit = CreateUnitHPR(unitBPid, armySupport[beacon.ArmyIndex], NearestOffMapLocation[1], NearestOffMapLocation[2], NearestOffMapLocation[3],0,0,0)
local TransportClass = newUnit:GetBlueprint().Transport.TransportClass
table.insert(UnitsToTransport[TransportClass], newUnit)
end
Specifically, the following line will error out and cause reinforcement spawning to fail for all armies past the first two. " local newUnit = CreateUnitHPR(unitBPid, armySupport[beacon.ArmyIndex], NearestOffMapLocation[1], NearestOffMapLocation[2], NearestOffMapLocation[3],0,0,0)"
I recommend the following adjustment to the assignSupports function:
- Code: Select all
assignSupports = function()
local ArmiesList = ScenarioInfo.ArmySetup
for name,army in ScenarioInfo.ArmySetup do
if army.ArmyIndex == 1 then
factions[1] = army.Faction
teams[1] = army.Team
beaconTime[1] = 0
elseif army.Team == teams[1] then
factions[1] = army.Faction
teams[1] = army.Team
beaconTime[1] = 0
elseif not army.Team == team[1] then
factions[2] = army.Faction
teams[2] = army.Team
beaconTime[2] = 0
end
end
for name,army in ScenarioInfo.ArmySetup do
if army.ArmyName == "SUPPORT_1" then
army.Team = teams[1]
army.Civilian = false
army.ArmyColor = 1
army.PlayerColor= 1
army.Faction = factions[1]
army.PlayerName="gw_support_1"
armySupport[1] = army.ArmyName
armySupportIndex[1] = army.ArmyIndex
army.Support = true
elseif army.ArmyName == "SUPPORT_2" then
army.Team = teams[2]
army.ArmyColor = 2
army.PlayerColor=2
army.Civilian = false
army.Faction = factions[2]
army.PlayerName="gw_support_2"
army.Support = true
armySupport[2] = army.ArmyName
armySupportIndex[2] = army.ArmyIndex
end
end
end
This adjustment should assign Support 1 to the first player, and then based upon the first player's team, it will assign all subsequent players to Support 1 if they are the same team as the first player and to Support 2 if they aren't. In this way, you can get by with only 2 supports. BEARING THAT IN MIND THIS WILL CAUSE ERRORS IN BATTLES WITH THREE OR MORE TEAMS.