|
马上注册领取绝版勋章
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 drug9_9 于 2018-5-17 02:31 编辑
原址:https://www.nexusmods.com/fallout4/mods/27674/?tab=description
修復生存模式下發生的VATS凍結錯誤。
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 seem to 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 ensure that it overwrites the HC_ManagerScript.pex file or simply replace it manually. 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 and the solution probably depends on what your mod does. The approach I took with STB was to use IsMovementControlsEnabled() to check whether the player could move because movement is always disabled in VATS, and it makes sense for STB because allowing the player to take bleed damage while they cannot move isn't a great idea.
I used weapon enchantments so that a script gets fired whenever a person or creature is hit by the weapon. The script checks if the player movement is disabled and if it is it will delay equipping the potion by using a timer which checks if movement has been re-enabled periodically and when it has the potion which applies the bleeding effect is equipped. Take a look at the source code provided with STB if you want to see exactly what I did to avoid the bug being triggered by my mod.
Tools Used
Creation Kit
Notepad++
|
评分
-
查看全部评分
|