Other user's assetsAll the assets in this file belong to the author, or are from free-to-use modder's resources
Upload permissionYou are not allowed to upload this file to other sites under any circumstances
Modification permissionYou are allowed to modify my files and release bug fixes or improve on the features without permission from or credit to me
Conversion permissionYou can convert this file to work with other games as long as you credit me as the creator of the file
Asset use permissionYou are allowed to use the assets in this file without permission or crediting me
Asset use permission in mods/files that are being soldYou are not allowed to use assets from this file in any mods/files that are being sold, for money, on Steam Workshop or other platforms
Asset use permission in mods/files that earn donation pointsYou must get permission to earn Donation Points for your mods if they use my assets
Console modding permissionThe author gave permission for someone else to port this mod to console and for it to be uploaded to Bethesda.net. Please credit the author, however
Author notes
This author has not provided any additional notes regarding file permissions
File credits
This author has not credited anyone else in this file
Donation Points system
This mod is opted-in to receive Donation Points
Changelogs
Version 0.1.3
Added check for VATS key being pressed (credit to legiaoday6557)
Version 0.1.2
Compiled scripts in release mode instead of debug mode
Altered MS19DiseaseScript so it wont cause freezes
Moved potion queue initialization to OnInit()
Version 0.1.1
Fixed initialization bug (credit to Dracotorre)
Added properties used by Everyone's Best Friend
Version 0.1.0
Merged fixes from Unofficial Fallout 4 Patch
Overview
This mod should fix the very annoying bug which causes VATS to freeze in survival mode. In the process of creating my first mod Stop The Bleeding, I accidentally discovered the cause of the VATS freezing bug and I was able to fix it by modifying the survival mode manager script. Any mods which overwrite the HC_ManagerScript.pex file will not be compatible with this mod, but I have included the source so any mod author can add the fix to their mod if they wish. This fix is already included with STB and based on feedback from several people it does work, however please note that some mods can still cause the issue to occur, but this fix by its self should remove any VATS freezing issues from the vanilla game.
Mods that may cause freezing:
- Automatic eat or drink mods - Auto-Stimpak mods
Installing
Use a mod manager and overwrite the HC_ManagerScript.pex file along with any other files if asked, or install the mod manually by extracting the Scripts folder so it overrides the Scripts folder in your FO4 data directory. Some times it wont work on an existing save, but it should work if you disable then re-enable survival mode or start a new game. If this fix doesn't seem to work on your existing save then disable survival mode and open the console then type cgf "Game.IncrementStat" "Survival Denied" -1 which should allow you to re-enable survival mode.
How It Works
Basically what I discovered is that if the Player.EquipItem() function is called while in VATS it will cause the game to freeze up. The survival mode manager script uses the EquipItem() function to equip "potions" which apply the effects of diseases and other effects such as hunger and thirst, because consuming potions is the only way to make the effects show up in the Pip-Boy. I took this approach when creating STB to make bleeding effects show in the Pip-Boy but I noticed if I got shot in VATS it would freeze, which led me to the cause. To fix the vanilla VATS freeze bug I altered HC_ManagerScript and added a potion queue so that if VATS is active potions are added to the queue instead of being immediately consumed, so they can be safely consumed after VATS has exited, at which point you should become hungry, thirsty, tired, etc.
Info For Mod Authors
If your mod overrides HC_ManagerScript.pex it should be easy to merge the changes from this fix, you can quickly see all changes by examining the diff of the vanilla source code against the source code provided with this mod. The way I detect whether or not VATS is active in this fix is to use RegisterForMenuOpenCloseEvent("VATSMenu") and then toggle a boolean value when OnMenuOpenCloseEvent detects VATS opening or closing (credit to cdante for the tip).
IMPORTANT: If your mod adds something to the game which could cause a potion to be equipped to the player while they are in VATS then it will cause freezing. The simplest solution is to use IsMovementControlsEnabled() because movement is always disabled when VATS is active, a timer can be used to delay the equipping of a potion until VATS has ended. However a more standardized and reliable solution would be to make use of the TryEquipPotion() function which has been added to HC_ManagerScript.
Here's an example script showing how to make use of this function: