Reinforcement Mod Problems Topic is solved

Reinforcement Mod Problems

Postby FunkOff » 30 Dec 2013, 01:24

Okay, I've taken a look at the code and I've found some problems:

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.
FunkOff
Supreme Commander
 
Posts: 1863
Joined: 26 Aug 2011, 17:27
Has liked: 14 times
Been liked: 43 times
FAF User Name: FakeOff

Re: Reinforcement Mod Problems

Postby Ze_PilOt » 30 Dec 2013, 02:20

The mod is not finished, and it's not planned before end of january.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Reinforcement Mod Problems  Topic is solved

Postby Ze_PilOt » 30 Dec 2013, 22:33

The fix was already implemented, but not released as the mod isn't finished.
I've backported the fix in the current version, as well as viewtopic.php?f=50&t=6075

By the way your code is incorrect : I won't fix anything, and the beacon time will be incorrects too.
The correct code is to use the Team as index for the armySupport table, and use the team of the beacon to call the proper AI.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt


Return to Galactic War

Who is online

Users browsing this forum: No registered users and 1 guest