I'm adding an animated stimpak injection to my Realism Tweaks' Med-Tec module and 90% of the time it works perfectly
The only problem is that my script disables the player controls while the animation is running (as a user key press will otherwise terminate the animation). And when the player's controls are disabled, any attacking enemies will immediately stop attacking until the player's controls are enabled again. My goal is to make the user vulnerable while using stimpaks, so this is not really working out.
I came up with two possible work-arounds, but have not been able to get either one to actually work.
A.) Prevent Stimpak use when player.isMoving (would allow me to use a brief disable/enable just to get the animation started) . . . which would only cause the enemy to stop attacking for the second or two that the player's controls are disabled (instead of for the entire 5 or 6 seconds that the animation/script runs). I can prevent the animation from running, if the player is moving, but the stimpak is still used.
B.) Prevent Stimpak use when an enemy is close (like within 3000 units). This would allow me to leave the player's controls disabled for the entire 5 or 6 seconds needed, without having nearby enemies cease their attacks (which really breaks combat immersion). I've tried using the walk-ref thing, but I cannot seem to get it to work at all (as I have no experience with walk-ref . . . so I don't really know what I'm doing).
Any help with this would be greatly appreciated! (I was up until 2am, trying to get this to work.)