Forged Alliance Forever Forged Alliance Forever Forums 2013-12-30T22:33:28+02:00 /feed.php?f=50&t=6067 2013-12-30T22:33:28+02:00 2013-12-30T22:33:28+02:00 /viewtopic.php?t=6067&p=60482#p60482 <![CDATA[Re: Reinforcement Mod Problems]]> 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.

Statistics: Posted by Ze_PilOt — 30 Dec 2013, 22:33


]]>
2013-12-30T02:20:22+02:00 2013-12-30T02:20:22+02:00 /viewtopic.php?t=6067&p=60404#p60404 <![CDATA[Re: Reinforcement Mod Problems]]> Statistics: Posted by Ze_PilOt — 30 Dec 2013, 02:20


]]>
2013-12-30T01:24:34+02:00 2013-12-30T01:24:34+02:00 /viewtopic.php?t=6067&p=60388#p60388 <![CDATA[Reinforcement Mod 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:
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:
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:
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:
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.

Statistics: Posted by FunkOff — 30 Dec 2013, 01:24


]]>