Issue Data
|
Issue #28263: Freezing in VATS
My game can sometimes freeze when using VATS, there is a mod on the Nexus which prevents freezing in certain circumstances https://www.nexusmods.com/fallout4/mods/27674?tab=description
The script is freely available on the main page and would be suitable to include in UFO4P |
I use the above mod. and it does greatly reduce the incidence of this occurring. But very rarely I still get the freeze in VATS. Looking at this posting, looks like they were able to trace that last possible circumstance that the freeze could still occur.
"First let's make one thing clear, JacobBruce's VATS Freeze Fix does work to a certain extent and lowers the probability of the freeze happening considerably. This is because it prevents the freeze happening 'while' you're already in the VATS menu, it just doesn't prevent the freeze from happening during the initial camera pan of the VATS mode (more on that bellow).
Why does the freeze still happen then?
In the 'OnMenuOpenCloseEvent' event, JacobBruce's fix sets the value of the bool 'bIsVATSMenuOpen', this variable is used as a 'safeguard' to avoid calling 'PotionQueue.add(potionToApply)' when VATS is active. My theory is that there's a single frame gap between the player activating VATS and OnMenuOpenCloseEvent being fired by the game, and during this gap the value of bIsVATSMenuOpen is still 'false' which will allow 'PotionQueue.add(potionToApply)' to be called while the VATS menu is open, thus triggering the freeze.
After using more tracers to narrow down the source of the crash I've found the exact line that triggers the crash, it's 'PlayerRef.EquipItem(potionToApply, abSilent = true)' inside the 'TryEquipPotion' function. It seems my 'speculation' was right, 'OnMenuOpenCloseEvent' is taking to long to be called and consequently 'bIsVATSMenuOpen' is not being set fast enough. This "frame gap" I previously mentioned only happens during the 'zoom in' of the VATS camera, it's always the same specific frame (or couple of frames).
This also explains why I couldn't previously trigger the freeze when VATS Freeze Fix was installed, it was because I usually entered VATS mode way earlier so that I was well into the VATS mode when the 'potion' effect was added to my character, I didn't know the window for this 'other' freeze was only during the VATS transition animation and also was really narrow."
"First let's make one thing clear, JacobBruce's VATS Freeze Fix does work to a certain extent and lowers the probability of the freeze happening considerably. This is because it prevents the freeze happening 'while' you're already in the VATS menu, it just doesn't prevent the freeze from happening during the initial camera pan of the VATS mode (more on that bellow).
Why does the freeze still happen then?
In the 'OnMenuOpenCloseEvent' event, JacobBruce's fix sets the value of the bool 'bIsVATSMenuOpen', this variable is used as a 'safeguard' to avoid calling 'PotionQueue.add(potionToApply)' when VATS is active. My theory is that there's a single frame gap between the player activating VATS and OnMenuOpenCloseEvent being fired by the game, and during this gap the value of bIsVATSMenuOpen is still 'false' which will allow 'PotionQueue.add(potionToApply)' to be called while the VATS menu is open, thus triggering the freeze.
After using more tracers to narrow down the source of the crash I've found the exact line that triggers the crash, it's 'PlayerRef.EquipItem(potionToApply, abSilent = true)' inside the 'TryEquipPotion' function. It seems my 'speculation' was right, 'OnMenuOpenCloseEvent' is taking to long to be called and consequently 'bIsVATSMenuOpen' is not being set fast enough. This "frame gap" I previously mentioned only happens during the 'zoom in' of the VATS camera, it's always the same specific frame (or couple of frames).
This also explains why I couldn't previously trigger the freeze when VATS Freeze Fix was installed, it was because I usually entered VATS mode way earlier so that I was well into the VATS mode when the 'potion' effect was added to my character, I didn't know the window for this 'other' freeze was only during the VATS transition animation and also was really narrow."
Comment #1 Feb 13, 2023 2:52 pm
Edited by Lone_Wolf on Feb 13, 2023 2:53 pm
Showing Comments 1 - 1 of 1