Fallout 4

File information

Last updated

Original upload

Created by

JDBruce

Uploaded by

JacobBruce

Virus scan

Safe to use

About this mod

Fixes the VATS freezing bug that occurs in survival mode.

Requirements
Permissions and credits
Changelogs
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:


Scriptname MySafeScript extends ActiveMagicEffect

Hardcore:HC_ManagerScript Property HC_Manager auto const mandatory
Potion Property MyPotion auto mandatory
Actor Property PlayerREF auto mandatory

Event OnEffectStart(Actor akTarget, Actor akCaster)
If akTarget == PlayerREF
HC_Manager.TryEquipPotion(MyPotion)
EndIf
EndEvent


Tools Used
Creation Kit
Notepad++