Jump to content

R&D to Increase Squad Size


Beknatok

Recommended Posts

My day is a little brighter knowing what a psyduck is.

 

 

 

it appears that person is having trouble selecting stuff in the tactical game?

 

It looks like both strat and tactical game, now that you mention it. Based on additional player feedback, I agree that this likely isn't related to the change -- it just popped up right after I went live with a version of the mod with the OnMouseEvent change, so nothing to worry about going forward.

Link to comment
Share on other sites

  • Replies 429
  • Created
  • Last Reply

Top Posters In This Topic

 

How about letting DEMOAddNewSoldiers store the current offset in m_arrFillOrderIndex[12] every time the function is called and iNumSoldiers <127 ?

Yeah, sounds feasible, though a bit opaque. The significance of the value 127 and an additional array element wouldn't be immediately apparent to other people, but I suppose that's the price you pay for piggy-backing existing systems due to the strict limitations of UnrealScript hexing... you just have to make sure everything's properly documented :smile:

 

Opaque you say? Then look at this code: :smile:

 

 

function DEMOAddNewSoldiers(int iNumSoldiers)
{
  local XGStrategySoldier kSoldier;
  local int I;
  local array<XComGame.XGTacticalGameCoreNativeBase.EGender> arrGenders;
  PlaySound(soundcue'MenuSelectCue', true);
  //Possibly the worlds least efficient way of adding adding a zero to position 12 of an array and making sure it is big enough
  if (XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.Length < 13;)
  {
    XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.Length = 13;
    XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.[12] = 0;
  }
  
  if (iNumSoldiers < 127)  //Not called by Update function, store value of iNumSoldiers in m_arrFillOrderIndex[12]
  {
    XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.[12] = iNumSoldiers;
  }  
  
  if (iNumSoldiers == 127) //Called by Update function, change iNumSoldiers to 0 if run the very first time or the last known value which was less than 127.
  {
    iNumSoldiers = XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.[12];
  }

///////////////Nothing changed below this line/////////////////
  
  I = 0;
  J0xDF:
  // End:0x3EC [Loop If]
  if(I < HANGAR().m_kSkyranger.m_arrSoldiers.Length)
  {
    kSoldier = HANGAR().m_kSkyranger.m_arrSoldiers[I];
    // End:0x3DE
    if(kSoldier != none)
    {
      Idx = XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex[I];
      Idx -= iNumSoldiers;
      Idx = XComHQPresentationLayer(XComHeadquartersController(XComHeadquartersGame(class'Engine'.static.GetCurrentWorldInfo().Game).PlayerController).m_Pres).m_kSquadSelect.m_kSquadList.m_arrFillOrderIndex.Find(Idx);
      HANGAR().m_kSkyranger.m_arrSoldiers[I].m_iHQLocation = 6;
      HANGAR().m_kSkyranger.m_arrSoldiers[I].SetHQLocation(1, true, false, Idx);
    }
    ++ I;
    // [Loop Continue]
    goto J0xDF;
  }
  //return;  
}

 

 

Short and efficient? Nope, not at all, but it should on the other hand be very straightforward to implement in one big section and it would only require ~600 bytes of the available ~800 :smile:

 

I have already tested that seting the array size to 13 does not crash anything.

 

The only things I feel uncertain about is whether or not it is allowed to modify the incoming variable iNumSoldiers

 

Any comments or reasons to re-think the strategy?

If not, then I plan to implement it tomorrow and finally have a reason to use my new offset repair tool :)

Link to comment
Share on other sites

Opaque you say? Then look at this code: :smile:

Eek! :wacko: I'd very much prefer it if the fill order array could be stored in some borrowed local int array variable to get rid of that obscenely long call chain.

For some reason my attempts at this always failed as accessing the variable inside the loop at the bottom always caused the game to crash, no idea what I was missing there, maybe you have more luck :)

 

Any comments or reasons to re-think the strategy?

The logic appears solid, by all means go ahead :)

Link to comment
Share on other sites

This:

... calling DEMOAddNewSoldiers(127) from XGChooseSquadUI.UpdateView (offset 2712941)

 

 

2D 23 00 00 AB 1F 00 00 00 00 00 00 2D 23 00 00 91 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 01 00 00 28 1F 00 00 99 00 00 00 EC 00 00 00 1B C6 2B 00 00 00 00 00 00 16 1B F0 2B 00 00 00 00 00 00 16 05 7E 08 00 00 00 01 7E 08 00 00 0A 6E 00 25 1B 1A 2C 00 00 00 00 00 00 16 1B DA 2B 00 00 00 00 00 00 16 1B 97 2B 00 00 00 00 00 00 16 19 1B F4 02 00 00 00 00 00 00 16 0C 00 54 28 00 00 00 1B B1 07 00 00 00 00 00 00 24 7F 16 06 8C 00 0A 89 00 26 1B 95 2B 00 00 00 00 00 00 16 1B 97 2B 00 00 00 00 00 00 16 06 8C 00 0A FF FF 1C 91 08 00 00 16 04 0B 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 00 02 00 29 2C 00 00 00 00 00 00 

 

 

 

 

And this (letting DEMOAddNewSoldiers store offset in m_arrFillOrderIndex[12]):

 

 

XGFacility_Barracks.DEMOAddNewSoldiers() Dec Offset: 2866585, Hex Offset: 002BBD99
B6 28 00 00 AB 1F 00 00 00 00 00 00 B1 28 00 00 00 00 00 00 00 00 00 00 B6 28 00 00 00 00 00 00 C4 05 00 00 49 A0 00 00 16 07 00 00 12 06 00 00 1C AA FD FF FF 20 5C FA FF FF 27 4A 4A 4A 4A 16 07 51 02 96 36 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 2C 0D 16 0F 36 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 2C 0D 0F 10 2C 0C 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 25 07 26 03 96 00 B6 28 00 00 2C 7F 16 0F 10 2C 0C 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 00 B6 28 00 00 07 FB 03 9A 00 B6 28 00 00 2C 7F 16 0F 00 B6 28 00 00 10 2C 0C 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 0F 00 B4 28 00 00 25 07 13 07 96 00 B4 28 00 00 36 19 19 1B FA 10 00 00 00 00 00 00 16 09 00 CE 2A 00 00 00 01 CE 2A 00 00 09 00 D5 3D 00 00 00 01 D5 3D 00 00 16 0F 00 B5 28 00 00 10 00 B4 28 00 00 19 19 1B FA 10 00 00 00 00 00 00 16 09 00 CE 2A 00 00 00 01 CE 2A 00 00 09 00 D5 3D 00 00 00 01 D5 3D 00 00 07 05 07 77 00 B5 28 00 00 2A 16 0F 00 29 28 00 00 10 00 B4 28 00 00 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 A2 00 29 28 00 00 00 B6 28 00 00 16 0F 00 29 28 00 00 46 19 19 19 2E 87 20 00 00 19 2E 39 1D 00 00 19 2E 91 1D 00 00 19 12 20 FD FE FF FF 0A 00 3B FB FF FF 00 1C 92 FD FF FF 16 09 00 27 FB FF FF 00 01 27 FB FF FF 09 00 4A 1D 00 00 00 01 4A 1D 00 00 09 00 B2 FA FF FF 00 01 B2 FA FF FF 09 00 9A 1E 00 00 00 01 9A 1E 00 00 09 00 7B 16 00 00 00 01 7B 16 00 00 09 00 C7 16 00 00 00 01 C7 16 00 00 0A 00 00 29 28 00 00 16 0F 19 10 00 B4 28 00 00 19 19 1B FA 10 00 00 00 00 00 00 16 09 00 CE 2A 00 00 00 01 CE 2A 00 00 09 00 D5 3D 00 00 00 01 D5 3D 00 00 09 00 EA 44 00 00 00 01 EA 44 00 00 2C 06 19 10 00 B4 28 00 00 19 19 1B FA 10 00 00 00 00 00 00 16 09 00 CE 2A 00 00 00 01 CE 2A 00 00 09 00 D5 3D 00 00 00 01 D5 3D 00 00 16 00 00 00 00 00 00 1B D3 23 00 00 00 00 00 00 26 27 28 00 29 28 00 00 16 A5 00 B4 28 00 00 16 06 06 04 04 0B 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 00 02 00 B1 07 00 00 00 00 00 00

 

 

 

Results in newly added soldier pawns showing up in the correct slot without the need to scroll!

 

Edit: Fixed it by sacrificing some but not all of the off duty pawns. Skip down 2 posts for code change in SeqEvent_HQUnits.AddUnit()

However it also brought an old bug/feature into the light:

  • If there is a soldier pawn standing outside visible screen and a soldier is removed, then the soldier outside visible screen jumps into the now empty slot.

It could be narratively explained away by claiming that all soldiers wants to be seen and that they take any chance to jump into the mighty commanders spotlight, and quickly gets out of the way again if that slot is assigned to someone else...

 

But perhaps it is better to hunt down where soldiers are told to take any vacant slot if no dedicated slot could be found.

 

If I don't remember incorrectly there was a gigantic switch case handling that part in XComGame.upk?

 

Edit: It only took 619 extra bytes to add the offset into the fillorder-array and there are still 404 unused bytes left. And I now know for a fact that it is allowed to modify parameter variables inside the function in unreal script :smile:

Edited by Bertilsson
Link to comment
Share on other sites

Edit: Figured out a better way to do it!

 

A very quick and dirty fix to the issue with "slotless soldiers" jumping into any free slot, would be to sacrifice all off duty recreational pawns by removing the entire else section in SeqEvent_HQUnits.AddUnit() like this:

 

 

SeqEvent_HQUnits.AddUnit() Dec Offset: 5061546, Hex Offset: 004D3BAA
05 13 00 00 50 55 00 00 00 00 00 00 FF 12 00 00 00 00 00 00 00 00 00 00 05 13 00 00 00 00 00 00 22 00 00 00 8C 04 00 00 C7 02 00 00 C9 03 00 00 49 06 00 1D FF FF FF FF 15 14 2D 00 02 13 00 00 27 07 A7 01 82 99 00 04 13 00 00 25 16 18 15 00 96 00 04 13 00 00 01 F0 12 00 00 16 16 05 04 13 00 00 00 00 04 13 00 00 0A 6A 00 25 0F 01 FC 12 00 00 00 05 13 00 00 06 A4 01 0A 84 00 26 0F 01 FB 12 00 00 00 05 13 00 00 06 A4 01 0A 9F 00 2C 02 0F 01 FA 12 00 00 00 05 13 00 00 06 A4 01 0A BA 00 2C 03 0F 01 F9 12 00 00 00 05 13 00 00 06 A4 01 0A D5 00 2C 04 0F 01 F8 12 00 00 00 05 13 00 00 06 A4 01 0A F0 00 2C 05 0F 01 F7 12 00 00 00 05 13 00 00 06 A4 01 0A 0B 01 2C 06 0F 01 F6 12 00 00 00 05 13 00 00 06 A4 01 0A 26 01 2C 07 0F 01 F5 12 00 00 00 05 13 00 00 06 A4 01 0A 41 01 2C 08 0F 01 F4 12 00 00 00 05 13 00 00 06 A4 01 0A 5C 01 2C 09 0F 01 F3 12 00 00 00 05 13 00 00 06 A4 01 0A 77 01 2C 0A 0F 01 F2 12 00 00 00 05 13 00 00 06 A4 01 0A 92 01 2C 0B 0F 01 F1 12 00 00 00 05 13 00 00 06 A4 01 0A FF FF 14 2D 00 02 13 00 00 28 06 A7 01 06 A7 01 07 B1 02 2D 00 02 13 00 00 07 B1 02 77 01 EF 12 00 00 2A 16 0F 00 00 13 00 00 2E B5 46 00 00 00 05 13 00 00 07 0D 02 77 00 00 13 00 00 2A 16 19 00 00 13 00 00 0A 00 00 00 00 00 00 1B 85 5A 00 00 00 00 00 00 16 0F 00 01 13 00 00 2E CF 37 00 00 00 05 13 00 00 14 19 00 01 13 00 00 0A 00 D1 35 00 00 00 2D 01 D1 35 00 00 28 19 00 01 13 00 00 0F 00 00 00 00 00 00 61 2A 01 EF 12 00 00 4A 4A 4A 16 19 00 01 13 00 00 05 00 00 00 00 00 00 6F 82 24 07 16 19 00 01 13 00 00 0A 00 00 00 00 00 00 1B CD 5D 00 00 00 00 00 00 16 1B 4C 6E 00 00 00 00 00 00 16 04 2D 00 02 13 00 00 04 3A 03 13 00 00 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 40 02 00 75 02 00 00 00 00 00 00
function bool AddUnit(Object InUnit, optional int SlotIdx)
{
  local bool bAdded;
  local XComUnitPawn UnitPawn;
  local XComHumanPawn HumanPawn;

  SlotIdx = -1;
  bAdded = true;
  // End:0x1A7
  if((SlotIdx >= 0) && SlotIdx < MaxUnits)
  {
    switch(SlotIdx)
    {
      // End:0x6A
      case 0:
        Unit0 = InUnit;
        // End:0x1A4
        break;
      // End:0x84
      case 1:
        Unit1 = InUnit;
        // End:0x1A4
        break;
      // End:0x9F
      case 2:
        Unit2 = InUnit;
        // End:0x1A4
        break;
      // End:0xBA
      case 3:
        Unit3 = InUnit;
        // End:0x1A4
        break;
      // End:0xD5
      case 4:
        Unit4 = InUnit;
        // End:0x1A4
        break;
      // End:0xF0
      case 5:
        Unit5 = InUnit;
        // End:0x1A4
        break;
      // End:0x10B
      case 6:
        Unit6 = InUnit;
        // End:0x1A4
        break;
      // End:0x126
      case 7:
        Unit7 = InUnit;
        // End:0x1A4
        break;
      // End:0x141
      case 8:
        Unit8 = InUnit;
        // End:0x1A4
        break;
      // End:0x15C
      case 9:
        Unit9 = InUnit;
        // End:0x1A4
        break;
      // End:0x177
      case 10:
        Unit10 = InUnit;
        // End:0x1A4
        break;
      // End:0x192
      case 11:
        Unit11 = InUnit;
        // End:0x1A4
        break;
      // End:0xFFFF
      default:
        bAdded = false;
        // End:0x1A4
        break;
    }
  }
  // End:0x445
////////////// Remove everything from here /////////////
  else
  {
    // End:0x1DD
    if((Unit0 == none) && MaxUnits > 0)
    {
      Unit0 = InUnit;
    }
    // End:0x445
    else
    {
      // End:0x213
      if((Unit1 == none) && MaxUnits > 1)
      {
        Unit1 = InUnit;
      }
      // End:0x445
      else
      {
        // End:0x24A
        if((Unit2 == none) && MaxUnits > 2)
        {
          Unit2 = InUnit;
        }
        // End:0x445
        else
        {
          // End:0x281
          if((Unit3 == none) && MaxUnits > 3)
          {
            Unit3 = InUnit;
          }
          // End:0x445
          else
          {
            // End:0x2B8
            if((Unit4 == none) && MaxUnits > 4)
            {
              Unit4 = InUnit;
            }
            // End:0x445
            else
            {
              // End:0x2EF
              if((Unit5 == none) && MaxUnits > 5)
              {
                Unit5 = InUnit;
              }
              // End:0x445
              else
              {
                // End:0x326
                if((Unit6 == none) && MaxUnits > 6)
                {
                  Unit6 = InUnit;
                }
                // End:0x445
                else
                {
                  // End:0x35D
                  if((Unit7 == none) && MaxUnits > 7)
                  {
                    Unit7 = InUnit;
                  }
                  // End:0x445
                  else
                  {
                    // End:0x394
                    if((Unit8 == none) && MaxUnits > 8)
                    {
                      Unit8 = InUnit;
                    }
                    // End:0x445
                    else
                    {
                      // End:0x3CB
                      if((Unit9 == none) && MaxUnits > 9)
                      {
                        Unit9 = InUnit;
                      }
                      // End:0x445
                      else
                      {
                        // End:0x402
                        if((Unit10 == none) && MaxUnits > 10)
                        {
                          Unit10 = InUnit;
                        }
                        // End:0x445
                        else
                        {
                          // End:0x439
                          if((Unit11 == none) && MaxUnits > 11)
                          {
                            Unit11 = InUnit;
                          }
                          // End:0x445
                          else
                          {
                            bAdded = false;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
///////////// all the way down here //////////////////
  // End:0x54F
  if(bAdded)
  {
    // End:0x54F
    if(CineDummy != none)
    {
      HumanPawn = XComHumanPawn(InUnit);
      // End:0x4AB
      if(HumanPawn != none)
      {
        HumanPawn.PrepForMatinee();
      }
      UnitPawn = XComUnitPawn(InUnit);
      UnitPawn.bSkipRotateToward = false;
      UnitPawn.SetBase(CineDummy);
      UnitPawn.SetPhysics(7);
      UnitPawn.ResetIKTranslations();
      UpdateMatinee();
    }
  }
  return bAdded;
  //return ReturnValue;  
}

 

 

But I guess that would only be worth considering if no other alternative is possible.

 

On the positive side: When I tested this alternative the only thing not 100% OK is the pawn flickering when scrolling, removing or adding soldiers, so there is an actual end to the "jumping from one stone to the next", in sight.

Edited by Bertilsson
Link to comment
Share on other sites

Hmm... Perhaps a compromise is possible?

I'm thinking: What would happen if slot less pawns were distributed into slotIDx 6-11 only?

0 --> 6

1 --> 7,

2 --> 8,

3 --> 9,

4 --> 10

5 --> 11

Everyone else --> invisible

 

Edit: It seems to be working. There are now 6 soldiers hanging around the base, a few of them in places I have never seen before.

 

Edit2: Working fine with all 12 soldiers in the loadout screen!

 

 

SeqEvent_HQUnits.AddUnit() Dec Offset: 5061546, Hex Offset: 004D3BAA
05 13 00 00 50 55 00 00 00 00 00 00 FF 12 00 00 00 00 00 00 00 00 00 00 05 13 00 00 00 00 00 00 22 00 00 00 8C 04 00 00 1D 04 00 00 C9 03 00 00 49 06 00 1D FF FF FF FF 15 14 2D 00 02 13 00 00 27 07 A7 01 82 99 00 04 13 00 00 25 16 18 15 00 96 00 04 13 00 00 01 F0 12 00 00 16 16 05 04 13 00 00 00 00 04 13 00 00 0A 6A 00 25 0F 01 FC 12 00 00 00 05 13 00 00 06 A4 01 0A 84 00 26 0F 01 FB 12 00 00 00 05 13 00 00 06 A4 01 0A 9F 00 2C 02 0F 01 FA 12 00 00 00 05 13 00 00 06 A4 01 0A BA 00 2C 03 0F 01 F9 12 00 00 00 05 13 00 00 06 A4 01 0A D5 00 2C 04 0F 01 F8 12 00 00 00 05 13 00 00 06 A4 01 0A F0 00 2C 05 0F 01 F7 12 00 00 00 05 13 00 00 06 A4 01 0A 0B 01 2C 06 0F 01 F6 12 00 00 00 05 13 00 00 06 A4 01 0A 26 01 2C 07 0F 01 F5 12 00 00 00 05 13 00 00 06 A4 01 0A 41 01 2C 08 0F 01 F4 12 00 00 00 05 13 00 00 06 A4 01 0A 5C 01 2C 09 0F 01 F3 12 00 00 00 05 13 00 00 06 A4 01 0A 77 01 2C 0A 0F 01 F2 12 00 00 00 05 13 00 00 06 A4 01 0A 92 01 2C 0B 0F 01 F1 12 00 00 00 05 13 00 00 06 A4 01 0A FF FF 14 2D 00 02 13 00 00 28 06 A4 01 06 FD 02 07 DE 01 82 72 01 F6 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 00 16 16 0F 01 F6 12 00 00 00 05 13 00 00 06 FD 02 07 15 02 82 72 01 F5 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 01 16 16 0F 01 F5 12 00 00 00 05 13 00 00 06 FD 02 07 4C 02 82 72 01 F4 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 02 16 16 0F 01 F4 12 00 00 00 05 13 00 00 06 FD 02 07 83 02 82 72 01 F3 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 03 16 16 0F 01 F3 12 00 00 00 05 13 00 00 06 FD 02 07 BA 02 82 72 01 F2 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 04 16 16 0F 01 F2 12 00 00 00 05 13 00 00 06 FD 02 07 F1 02 82 72 01 F1 12 00 00 2A 16 18 0E 00 97 01 F0 12 00 00 2C 05 16 16 0F 01 F1 12 00 00 00 05 13 00 00 06 FD 02 14 2D 00 02 13 00 00 28 07 07 04 2D 00 02 13 00 00 07 07 04 77 01 EF 12 00 00 2A 16 0F 00 00 13 00 00 2E B5 46 00 00 00 05 13 00 00 07 63 03 77 00 00 13 00 00 2A 16 19 00 00 13 00 00 0A 00 00 00 00 00 00 1B 85 5A 00 00 00 00 00 00 16 0F 00 01 13 00 00 2E CF 37 00 00 00 05 13 00 00 14 19 00 01 13 00 00 0A 00 D1 35 00 00 00 2D 01 D1 35 00 00 28 19 00 01 13 00 00 0F 00 00 00 00 00 00 61 2A 01 EF 12 00 00 4A 4A 4A 16 19 00 01 13 00 00 05 00 00 00 00 00 00 6F 82 24 07 16 19 00 01 13 00 00 0A 00 00 00 00 00 00 1B CD 5D 00 00 00 00 00 00 16 1B 4C 6E 00 00 00 00 00 00 16 04 2D 00 02 13 00 00 04 3A 03 13 00 00 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 40 02 00 75 02 00 00 00 00 00 00
function bool AddUnit(Object InUnit, optional int SlotIdx)
{
  local bool bAdded;
  local XComUnitPawn UnitPawn;
  local XComHumanPawn HumanPawn;

  SlotIdx = -1;
  bAdded = true;
  // End:0x1A7
  if((SlotIdx >= 0) && SlotIdx < MaxUnits)
  {
    switch(SlotIdx)
    {
      // End:0x6A
      case 0:
        Unit0 = InUnit;
        // End:0x1A4
        break;
      // End:0x84
      case 1:
        Unit1 = InUnit;
        // End:0x1A4
        break;
      // End:0x9F
      case 2:
        Unit2 = InUnit;
        // End:0x1A4
        break;
      // End:0xBA
      case 3:
        Unit3 = InUnit;
        // End:0x1A4
        break;
      // End:0xD5
      case 4:
        Unit4 = InUnit;
        // End:0x1A4
        break;
      // End:0xF0
      case 5:
        Unit5 = InUnit;
        // End:0x1A4
        break;
      // End:0x10B
      case 6:
        Unit6 = InUnit;
        // End:0x1A4
        break;
      // End:0x126
      case 7:
        Unit7 = InUnit;
        // End:0x1A4
        break;
      // End:0x141
      case 8:
        Unit8 = InUnit;
        // End:0x1A4
        break;
      // End:0x15C
      case 9:
        Unit9 = InUnit;
        // End:0x1A4
        break;
      // End:0x177
      case 10:
        Unit10 = InUnit;
        // End:0x1A4
        break;
      // End:0x192
      case 11:
        Unit11 = InUnit;
        // End:0x1A4
        break;
      // End:0xFFFF
      default:
        bAdded = false;
        // End:0x1A4
        break;
    }
  }
  // End:0x2FD
  else
  {
    // End:0x1DE
    if((Unit6 == none) && MaxUnits > 0)
    {
      Unit6 = InUnit;
    }
    // End:0x2FD
    else
    {
      // End:0x215
      if((Unit7 == none) && MaxUnits > 1)
      {
        Unit7 = InUnit;
      }
      // End:0x2FD
      else
      {
        // End:0x24C
        if((Unit8 == none) && MaxUnits > 2)
        {
          Unit8 = InUnit;
        }
        // End:0x2FD
        else
        {
          // End:0x283
          if((Unit9 == none) && MaxUnits > 3)
          {
            Unit9 = InUnit;
          }
          // End:0x2FD
          else
          {
            // End:0x2BA
            if((Unit10 == none) && MaxUnits > 4)
            {
              Unit10 = InUnit;
            }
            // End:0x2FD
            else
            {
              // End:0x2F1
              if((Unit11 == none) && MaxUnits > 5)
              {
                Unit11 = InUnit;
              }
              // End:0x2FD
              else
              {
                bAdded = false;
              }
            }
          }
        }
      }
    }
  }
  // End:0x407
  if(bAdded)
  {
    // End:0x407
    if(CineDummy != none)
    {
      HumanPawn = XComHumanPawn(InUnit);
      // End:0x363
      if(HumanPawn != none)
      {
        HumanPawn.PrepForMatinee();
      }
      UnitPawn = XComUnitPawn(InUnit);
      UnitPawn.bSkipRotateToward = false;
      UnitPawn.SetBase(CineDummy);
      UnitPawn.SetPhysics(7);
      UnitPawn.ResetIKTranslations();
      UpdateMatinee();
    }
  }
  return bAdded;
  //return ReturnValue;  
}

 

 

I'm guessing that if we could find a way to check in which room the soldier is then we could do something like this:

Else {

if (Room != Hangar) {

if((Unit0 == none) {

Unit0 = InUnit;

}

else if (Unit1 == none) {

...

}

}

}

 

But from my perspective I am quite content with only 6 off duty soldiers.

Edited by Bertilsson
Link to comment
Share on other sites

I have now put together a new toolboks mod with the current progress:


Installation instruction

  1. Download and install (unzip) toolboks http://xcom.nexusmods.com/mods/79//?
  2. Download and unzip this file into the Custom Mods folder (inside the folder where you installed toolboks) http://hem.bredband.net/bertrich/XCOM/Temp/Increased_Squad_Size_v0_94.zip
  3. Open toolboks and use the Custom Mods tab to install Increased_Squad_Size_v0_94.txt
  4. Optionally edit the last line in Increased_Squad_Size_v0_94.txt and repeat step 3 to change the number of soldiers (Vanilla seting is SkyRanger capacity = 4)
Known issues

  • Soldiers temporarily stutter when added, removed or rotated in the squad selection screen.
    • Don't think we will be able to find an easy fix to this and don't realy think it is a big problem either even though smother update would have been nice.

  • Setting SKYRANGER_CAPACITY to values above 10 (total 12 soldiers with OTS upgrades) is not recommended.
    • Don't really see a need for expanding support to even more soldiers, especially not with new expansion coming soon.

  • The 12th soldier share spawn location with another soldier in the tactical game.
    • Requires tons of testing to fix, not going to happen before new expansion.

  • Officer Training School Squad Size I and II description texts are not reflecting correct number of soldiers.
    • This one is very simple to fix with any text editor by changing "OTSTechSummary[eOTS_SquadSize_I]" and OTSTechSummary[eOTS_SquadSize_II] in

SystemDisk:\Users\AccountName\Documents\My Games\XCOM - Enemy Unknown\XComGame\Localization\INT\XComStrategyGame.int but I don't think toolboks has any support for doing that.


  • Only six off duty soldier pawn hanging around the base instead of "up to 12" (I don't think I have ever seen more than ~9)
    • Forgot to mention this one in the toolboks mod

Edited by Bertilsson
Link to comment
Share on other sites

If willing to sacrifice other existing OTS-upgrades for the purpose then I'm guessing this function could be re-written into a for loop that will accommodate that:

function int GetCapacity()
{
  local int iCapacity;

  iCapacity = m_iCapacity;
  // End:0x43
  if(BARRACKS().HasOTSUpgrade(1))
  {
    ++ iCapacity;
  }
  // End:0x73
  if(BARRACKS().HasOTSUpgrade(2))
  {
    ++ iCapacity;
  }
  return iCapacity;
  //return ReturnValue;  

The OTS naggers would also need to be reworked or removed.

 

Alternatively the other OTS-upgrades could be preserved if the effect of SquadSize I or II was increased to 2 for both upgrades or to 1 for squadsize 1 and 2 for squadsize 2.

 

I don't really see it as part of this mod though... But if you make a forum thread requesting it as a separate add-on, for this mod or long war mod, I will most likely try to implement it.

Edited by Bertilsson
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...