PCS Dissapearing

Amineri

Re: PCS Dissapearing

Post by Amineri »

So my best guess at this point is that this is some sort of weird serialization/deserialization error. All of the reports indicate that the problem occurs when a save/load cycle is run, and that the PCS is no longer present after the load.

So here's some background on how the PCS slot works...

The PCS slot is handled pretty much like any other inventory slot (e.g. armor, primary weapon, secondary weapons, utility). However, it has its own slot type

Code: Select all

eInvSlot_CombatSim
. The number of such inventory slots is also handled in a somewhat unusual way. Instead of being tied to equipment, there is a character stat which is used to determine the number of such slots available. If you look at any class (including the LW2 classes), you'll see that the squaddie rank always adds :

Code: Select all

StatType=eStat_CombatSims,StatAmount=1
That is, the first rank always grants +1 to this eStat_CombatSims.

Making the situation stranger yet, the XCGS_Unit GetPCSRanks function has the following :

Code: Select all

// Does not matter which class we grab, all should have same combat sim stats
SoldierClassTemplate = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate('Ranger');
That is, it always checks only the base XCOM 2 Ranger class to determine when PCS availability should occur.

Even though in theory the stat could go above 1, in practice the code and the UI don't support multiple PCSs (we considered this, but it would have been a fair amount of work so we pushed more in other areas). Instead, this data is reduced to a boolean using the function :

Code: Select all

function bool IsSufficientRankToEquipPCS()
This reduces all of the previous stuff to a simple yes/no as to whether the soldier can equip a PCS. And since it's basically hard-coded to only check one class, this means that all soldiers get ability to equip one PCS at squaddie.

This rank requirement gets combined with other requirements in the UIUtilities_Strategies class function

Code: Select all

simulated static function GetPCSAvailability(XComGameState_Unit Unit, out TPCSAvailabilityData PCSAvailabilityData)
This static helper function determines whether or not a unit can equip a PCS. It checks several things :

1) How many PCS are currently equipped?:

Code: Select all

EquippedImplants = Unit.GetAllItemsInSlot(eInvSlot_CombatSim);
2) How many PCS slots does the unit have to equip?:

Code: Select all

AvailableSlots = Unit.GetCurrentStat(eStat_CombatSims);
3) Does the unit have a free PCS slot to equip a PCS?:

Code: Select all

PCSAvailabilityData.bHasCombatSimsSlotsAvailable = ( AvailableSlots > EquippedImplants.Length ); 
4) Are there any PCS in the XCOM inventory to be equipped?:

Code: Select all

PCSAvailabilityData.bHasNeurochipImplantsInInventory = XComHQ.HasCombatSimsInInventory();
5) Has the unit reached sufficient rank to equip a PCS?: (note this is redundant with 3)

Code: Select all

PCSAvailabilityData.bHasAchievedCombatSimsRank = Unit.IsSufficientRankToEquipPCS();
6) Has the player built a GTS facility?:

Code: Select all

PCSAvailabilityData.bHasGTS = XComHQ.HasFacilityByName('OfficerTrainingSchool');
7) Are there even any available PCS slots to equip to?: (again, this is redundant info)

Code: Select all

PCSAvailabilityData.bCanEquipCombatSims = (AvailableSlots > 0);
The results of this GetPCSAvailability is used in two places : in the Armory_MainMenu to determine whether the "Equip PCS" button should be enabled/disabled, and in UIArmory_Implants to determine whether a soldier can be cycled to when in that menu.

---------------------------------------------------------------------------------

The application/removal is almost entirely initiated within the class UIInventory_Implants.

This class has functions RemoveImplant and InstallImplant. Both of these functions appear (from code-read) to create and submit a changestate to the history (which would be the most other most likely case of items disappearing). In particular if a PCS is "disappearing", it would have to be applied to the unit, but not persist in the unit inventory through a save/load cycle. The addition of a new PCS to a unit inventory inside of UIInventory_Implants.InstallImplant is handled via :

Code: Select all

UpdatedUnit.AddItemToInventory(UpdatedImplant, eInvSlot_CombatSim, UpdatedState);
This same AddItemToInventory function is used for every other type of item equipping -- armor, primary/secondary weapons, utility, grenade slot, heavy weapons and so on.

A unit's inventory is pretty much just an array of references to XComGameState_Item objects in the history. The class variable for unit inventory is :

Code: Select all

var() protectedwrite array<StateObjectReference> InventoryItems;    //Items this units is carrying
This is protected write, so no class outside of XComGameState_Unit can change this list, BUT if the item is destroyed then the reference in the array will be no longer retrievable from the history, thus acting as if the item had been removed. The primarily line of code by which items are added to inventory is simply :

Code: Select all

InventoryItems.AddItem(Item.GetReference());
Since the basic inventory management by which PCS items are stored is common across all items equipped to a unit, it seems unlikely that this could be a problem with that, since there are no similar reports of randomly disappearing gear that I've seen. At the same time, the serialization/deserialization code seems an unlikely candidate. If it's the former, then it's possible to fix via mod. If it's the latter, that is all handled deep in native code and would require a fix from Firaxis.
Sines
Posts: 159
Joined: Tue Jan 24, 2017 8:36 pm

Re: PCS Dissapearing

Post by Sines »

I don't know how much this'll help, but I've discovered this myself while gearing up for my second HQ, and finding that the soldiers I had just equipped with PCS for the Network Tower now no longer had PCS. I remember when setting them up for the Network Tower being surprised that they didn't have any, but figured that was probably just me forgetting about the slot.

But gearing up for the HQ, I knew I was using some newer characters who might not have had PCS, so I handed them out. This was on the loadout screen, where I found it easier to prep my squad before sending them out, rather than doing it through the barracks. And when I went to check if I had a common or rare agility PCS on my Assault, I found she had none. All but one of my Soldiers had lost the PCS I had given them for the Network Tower.

I no longer had any pre-battle auto-saves, but I did load up the oldest battle auto-save to check one soldiers Dodge levels, and found that they were lower than they should be, if she still had the Agility PCS I had given her. She must have lost her PCS after me giving it to her, but before the end of the mission.

I put some replacement PCS on them, and then I saved and quit the game, and checked out the forums to find this was a problem. I was about to wrap up for the night when I realized I could just console command the PCS back. I figured I'd get that done before I went to bed. However, when I loaded up to replace the leftovers I had used, I had found that they had disappeared AGAIN. I used console commands to restock everyone again, saved, quit and reloaded. PCS seem to have stuck this time.

Now it's possible that I didn't remember things correctly for the second loss. Since it was the same soldiers missing their PCS as last time, I think I might have made the save, then went to check my Assaults PCS, and then forgot to re-save after replacing them. However, I don't think this is the first time this happened to me. While it's possible I simply forgot to give PCS to three of my most used soldiers until my second Network Tower, it seems far more likely that I had given them some, but that they'd disappeared.

By the way, it might be a good idea to put in the console commands for the new PCS you guys added. I only lost ones with obvious names that either are in Vanilla, or easily fit the Vanilla format (Like Advanced Defense). But I'm not sure about some of the more esoteric ones. Like Hyper-Reactive Pupils, for example. Console Commands are a quick and easy work-around for the bug, and it would be helpful for others to have them in this thread so people can restore what they've lost without too much trouble.

For those who don't know, the general format for console-adding a PCS to your inventory is

[Quality]PCS[pcsName]
(eg: AddItem EpicPCSConditioning 5 - will give me 5 Advanced Conditioning (+4 HP) PCS)
pcsName can be: Speed, Conditioning, Focus, Perception, Agility
Quality can be: Common (Normal), Rare (Advanced), Epic (Superior)

This is for Vanilla, however, so won't have all the new PCS from Long War. I found that Defense PCS are exactly as they say they are (RarePCSDefense got me a new Advanced Defense PCS). Didn't try out any others.
cerebrawl
Posts: 137
Joined: Mon Jan 30, 2017 10:41 am

Re: PCS Dissapearing

Post by cerebrawl »

3dahs wrote:Well I know the character Jaime 'Double J' Padilla is cursed and also Kam "The Skam" Ayeni. Load a pcs in him and play a mission or two. It will disappear. I'm really not sure what causes it. I'm trying UzielTD recommendation, in a new playthrough, saving/exiting to menu then loading game and inserting PCS and then saving/exiting to menu and loading game again. Everything is good so far. I'll let you know if I run into any problems.
It could be related to some cosmetic mod. IE: specific cosmetic feature makes the soldier bug out.
DocKevster
Posts: 1
Joined: Sun Feb 05, 2017 2:20 pm

Re: PCS Dissapearing

Post by DocKevster »

I have observed this happening in my LW2 game. I have no mods besides LW2 and have been on version 1.1 (unfortunately Ironman, because I am masochistic). Saving and exiting seems like it may be the culprit because equipping the PCS on someone on the equip for mission screen then backing out and saving was all that was required to make one of them disappear.
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Dissapearing

Post by 3dahs »

cerebrawl wrote:
3dahs wrote:Well I know the character Jaime 'Double J' Padilla is cursed and also Kam "The Skam" Ayeni. Load a pcs in him and play a mission or two. It will disappear. I'm really not sure what causes it. I'm trying UzielTD recommendation, in a new playthrough, saving/exiting to menu then loading game and inserting PCS and then saving/exiting to menu and loading game again. Everything is good so far. I'll let you know if I run into any problems.
It could be related to some cosmetic mod. IE: specific cosmetic feature makes the soldier bug out.
Two of the characters they disappeared on don't use special cosmetic features. They were made before even the DLC came out so use base game cosmetics. I too believe that it has something to do with equipping the PCS on the equipment screen. From what I remember, I believe I had equipped those characters with their PCS in the equipment screen (right before a mission) and later the PCS disappeared. Although I could just be remembering things wrong but I haven't had problems yet in my new playthrough with a PCS disappearing because I'm making sure to equip them in the barracks before any missions and I'm also trying UzielTD's suggestion of saving/exiting before and after equipping the PCS.
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Disappearing

Post by 3dahs »

So it just happened again in my most recent playthrough. I was even trying the save & exit before and after you install the PCS recommendation. The video is 3mins long and happens right away. I wish I would have checked it from the barracks instead of the soldier selection edit menu so we could have ruled that out.

https://www.twitch.tv/videos/120064512

- I created that character a few days after Xcom2 came out, if not the day of. Is it possible that earlier custom created characters are somehow bugged?

- I don't believe it's other mods because some of the other users here are reporting they're having issues with this and they're running vanilla Longwar.

- Is this happening to anyone not playing Ironman? I've noticed most of us are playing Ironman.

- Has anyone ever seen or heard of this happening in vanilla Xcom2? I'm pretty sure if it was happening we would have seen a forum post or it would have been a known bug by now, seeing how frequently it happens.

Question for the longwar team:
Is there any way I can edit the stats of my soldier back to before he got this PCS? I'm going to want to give him an ADV Hacking PCS in the future and now that the basic one is permanent I don't want to feel like I'm cheating.
dodger
Posts: 63
Joined: Mon Jan 23, 2017 5:28 am

Re: PCS Dissapearing

Post by dodger »

mattprice516 wrote: Main observation/comment: Bug only appears to manifest on certain soldiers, but for those soldiers it WILL manifest consistently. At least as far as I can tell. This was the case in my last campaign in which I tracked every soldier who ever got a PCS - out of 26 soldiers I observed, only 4 of them ever had a PCS eaten. Of those 4, 2 had multiple eaten in the time I observed them.

If a +stat PCS is eaten, the stats will actually stay permanently, making this a bit of a minor exploit in some cases (you can put another +stat PCS that'll then get eaten, and another, until you have a soldier with ridiculous stats).

If an ability PCS is eaten, it's just gone.
Definitely saw this in my current campaign (started fresh with 1.1) will see if I have any saves that can reproduce.

EDIT: Nope, oldest save I still have was after. I know at least one guy who this happened on though so I will try adding some PCS to him.
mattprice516
Long War 2 Crew
Posts: 265
Joined: Tue Jan 10, 2017 12:49 am

Re: PCS Dissapearing

Post by mattprice516 »

@3dahs - definitely a vanilla bug of some sort. Even observed on PS4. Some think it was introduced with SLG but I'm not sure if that's confirmed.

https://steamcommunity.com/app/268500/d ... 702867877/
https://steamcommunity.com/app/268500/d ... 937256203/
https://steamcommunity.com/app/268500/d ... 956424854/
http://www.playstationtrophies.org/foru ... aring.html
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Dissapearing

Post by 3dahs »

mattprice516 wrote:@3dahs - definitely a vanilla bug of some sort. Even observed on PS4. Some think it was introduced with SLG but I'm not sure if that's confirmed.

https://steamcommunity.com/app/268500/d ... 702867877/
https://steamcommunity.com/app/268500/d ... 937256203/
https://steamcommunity.com/app/268500/d ... 956424854/
http://www.playstationtrophies.org/foru ... aring.html
Just made my day Matt. Thanks for the reply man. This makes me feel a lot better that it's something on Firaxis end. I mean it's terrible to know they're not fixing their own game, but it feels good to know I can start another campaign knowing it's not something with Longwar. Since I'm playing Ironman, before I install a PCS I'll make a copy of the save file and put it on my desktop. So if it disappears I'll just replace that file. Any chance of telling me or hinting if 1.2 will be out by this week? Should I wait? :D
dodger
Posts: 63
Joined: Mon Jan 23, 2017 5:28 am

Re: PCS Dissapearing

Post by dodger »

3dahs wrote:
mattprice516 wrote:@3dahs - definitely a vanilla bug of some sort. Even observed on PS4. Some think it was introduced with SLG but I'm not sure if that's confirmed.

https://steamcommunity.com/app/268500/d ... 702867877/
https://steamcommunity.com/app/268500/d ... 937256203/
https://steamcommunity.com/app/268500/d ... 956424854/
http://www.playstationtrophies.org/foru ... aring.html
Just made my day Matt. Thanks for the reply man. This makes me feel a lot better that it's something on Firaxis end. I mean it's terrible to know they're not fixing their own game, but it feels good to know I can start another campaign knowing it's not something with Longwar. Since I'm playing Ironman, before I install a PCS I'll make a copy of the save file and put it on my desktop. So if it disappears I'll just replace that file. Any chance of telling me or hinting if 1.2 will be out by this week? Should I wait? :D
It does seem to be happening more commonly with the LW2 mod though...
dodger
Posts: 63
Joined: Mon Jan 23, 2017 5:28 am

Re: PCS Dissapearing

Post by dodger »

Will reproduceable save files still help at this point?

I spent several hours trying to test load/save/reload/quit game/reload last night and could not get it to reproduce for 2 PCS on 2 different characters...

Today I loaded up my save and they've both lost their PCS...
Mad Madigan
Posts: 3
Joined: Fri Feb 10, 2017 4:20 pm

Re: PCS Dissapearing

Post by Mad Madigan »

Just confirming that I have consistently run into this bug as well. It took me a while to even notice it because many PCS's don't have a huge effect early in the game, but as I started finding more and more PCS's that mimic genemods from LW1 it finally became apparent. The most recent example was a Sharpshooter that I gave Depth Perception to prior to a Supply Raid. After the mission I went to unequip his weapon mods and limited supply gear and noticed he had the "!" notation on his PCS UI button. Sure enough, Depth Perception had disappeared.

I came here to see if this was a common bug and found this thread, so I went back to my save file to see if any other troopers had lost their PCS. Sure enough, EVERY soldier in my roster that had a PCS that mimicked genemod abilities no longer had them (Smart Macrophages, Emergency Life Support, Depth Perception, etc.). I wanted to help and try to repro this, but unfortunately I don't have any more PCS items to equip on my soldiers. Oddly, the soldiers that are using "vanilla" PCS's like +HP, +Aim, +Movement, etc. all still have theirs, even the crappy ones that I first installed way at the beginning of my current campaign.

I'm only mentioning this because despite this being listed as a Vanilla XCOM 2 bug, it is very odd that ONLY the new PCS's added with LW2 have disappeared in my campaign.

Oh, I should also mention that I do NOT have any DLC mission/customization option packs installed save for Shen's Last Gift. I'm not sure if that would make a difference or not, but everything is probably worth mentioning at this point.
UzielTD
Posts: 20
Joined: Fri Jan 27, 2017 12:48 am

Re: PCS Dissapearing

Post by UzielTD »

I've gotten it again, but oddly enough I've noticed that it seems to happen immediately after a save. So, Save>Give PCS>Save Again>Load>PCS now gone.

I'm not sure if my earlier observations were mistaken or what but returning from a mission or aborting will do nothing (i.e. not trigger the glitch) unless you save right before giving someone a PCS. I'm not sure if its the save mechanism itself that does it and I don't understand how I managed to reliably reproduce the glitch earlier without actually saving immediately before but that seems to be what's triggering the glitch in my current campaign.

The prevention method still works. Not sure if it's working for everybody, though.
dodger
Posts: 63
Joined: Mon Jan 23, 2017 5:28 am

Re: PCS Dissapearing

Post by dodger »

UzielTD wrote: The prevention method still works.
Which? Detail the steps please?
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Dissapearing

Post by 3dahs »

UzielTD wrote:SOLUTION: Get this dam bug fixed yo ;P. In the mean time, saving then loading that save immediately before AND after equipping any PCS's should prevent this particular glitch from rearing its ugly head. I've confirmed that this works by save/loading before and after giving a character a PCS and then forcing the glitch to happen again afterwards on a second character. The first character retained his PCS and the second one lost it. In fact, you probably only need to save/load right before equipping a PCS to reset whatever is causing the bug to manifest, but better safe than sorry. Unfortunately, I don't think there's any way to get back PCS's you've already lost in a particular save.
Didn't work for me Dodger, but you're welcome to try it.
mattprice516
Long War 2 Crew
Posts: 265
Joined: Tue Jan 10, 2017 12:49 am

Re: PCS Dissapearing

Post by mattprice516 »

I've been able to reproduce this bug consistently now. I load a save, give a bunch of people PCS from the geoscape pre-mission squad select, then save, then exit the game. When I relaunch the game and reload the save, the PCS'es are gone.

EDIT: It doesn't seem to happen when I follow the exact same steps, but by giving the PCS from soldier roster screen instead of geoscape pre-mission squad select.

EDIT 2: Also doesn't seem to happen when giving PCS from squad edit screen.

So in summary - try loading a save, giving someone a PCS from the geoscape pre-infiltration/mission squad select, then immediately save, exit and reload. That's reproduced it consistently for me, and on 5 different soldiers. And if you're trying to make it NOT happen, only give PCS from the soldier roster screen. Probably....?
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Dissapearing

Post by 3dahs »

Hey Matt, have you watched my 3min twitch highlight about the disappearing PCS? I installed it in the barracks, but I checked to see if it was there in geoscape pre-mission squad select screen and it had disappeared. So it's still possible to lose if you install it at barracks but maybe checking it at the geoscape pre-mission squad select screen made it disappear for me.
mattprice516
Long War 2 Crew
Posts: 265
Joined: Tue Jan 10, 2017 12:49 am

Re: PCS Dissapearing

Post by mattprice516 »

Curiouser and curiouser.... we're about to start testing a possible fix for this though eta is still unknown.
3dahs
Posts: 34
Joined: Tue Jan 31, 2017 2:02 pm

Re: PCS Dissapearing

Post by 3dahs »

mattprice516 wrote:Curiouser and curiouser.... we're about to start testing a possible fix for this though eta is still unknown.
Awesome glad to hear you guys are still working on a fix. You guys are amazing and I truly can't wait for Terra Invicta. I know it will be a great game and you will definitely have my pre-order & kickstarter help. Thank you.
rookie.one
Posts: 42
Joined: Sun Feb 05, 2017 6:08 pm

Re: PCS Dissapearing

Post by rookie.one »

mattprice516 wrote:I've been able to reproduce this bug consistently now. I load a save, give a bunch of people PCS from the geoscape pre-mission squad select, then save, then exit the game. When I relaunch the game and reload the save, the PCS'es are gone.
First of all, i can't reliable reproduce that bug, but it happens from time. When it happens, it doesn't matter if the PCS were equipped form geoscape, soldier menu or probably (didn't test that) from squad edit menu. I also don't have to load a save game in the 1st place (maybe that's triggered by quickload within a mission) and also don't have to exit and load at all to make this bug appear.

What i noticed though was that this bug appears when there is an issue with ingame time: current example i noticed it:

i was on a mission (save b4 mission 12/27 - 1:35am, mission it self: 12/28), i completed the mission, saved (geoscape 12/27 - 2:40pm), equipped some new PCS through armory menu, entered a new mission across the world and saved (at 12/27 - 2:48pm). on that savegame i noticed that the PCS were already gone (didn't load at anytime between mission exit, PCS inserting and PCS disappearing). as i continued playing i noticed that while i was flying to the next coordinates the time jumped back to 12:00 pm and i arrived at the new location at 12/27 - 1:32 pm.

I noticed something similar b4 when doing some testing with that, and i strongly believe that it has something to do with this bugged ingame time.

Hope that helps

(win 10 64bit, steam, LW1.1, can provide save games, using the option pause on recruit, mods: might maybe be some conflict with: instant avenger menus, can't think of anything else. using some other QoL stuff like: quick soldier info, commander's choice, stop wasting my time, perfect information, tacticalUI Killcounter, EVAC all)
rookie.one
Posts: 42
Joined: Sun Feb 05, 2017 6:08 pm

Re: PCS Dissapearing

Post by rookie.one »

Did some further testing: I simply couldn't reproduce the bug with above savegames (ingame times where totally different after loading then b4 without a load at all), but i can more or less reliably reproduce the bug now:

just equip a PCS (amory menu, squad menu, geoscape, doesn't matter at all), fly to a new location across the world and the chances are quite good that the PCS is gone. can rinse repeat that until the PCS is eventually gone. no save/loads needed.

while flying around i noticed strange behavior of the ingame time though (jumping forth and back), which kind of confirms my assumption that this bug is due to some ingame time inconsistencies. might be that there is some kind of calculation error within the flight speed/time calculation (e.g. flight time becoming negative).

hope that helps

edit: the only way i figured to 100% keep the PCS is by scanning a region for a couple of hours, equipping a PCS, scanning again.
User avatar
johnnylump
Site Admin
Posts: 1261
Joined: Wed Nov 11, 2015 4:12 am

Re: PCS Dissapearing

Post by johnnylump »

Attempted fix for 1.3, moving to resolved.
Post Reply