Unofficial Fallout 4 Patch

  • Status Closed
  • Percent Complete
  • Task Type Bug Report
  • Category Actors
  • Assigned To
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version Fallout 4: Vanilla
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 2
  • Private
Attached to Project: Unofficial Fallout 4 Patch
Opened by spacefiddle - January 31 2017
Last edited by Arthmoor - May 06 2017

FS#21994 - Solution: Companions repeat their random dialogue non-stop once dismissed

When a companion is dismissed anywhere, they are found at that location repeating all their random voice lines non-stop. This is because an error in FollowersScript sets the values of both IdleChatterTimeMin and IdleChatterTimeMax to zero, causing constant firing. The source of the error appears to be that a variable is being used in a function that only accepts a float as a parameter, resulting in NONE.

The intent seemed to be: the companions have an interval to say their lines - when they are picked up as a companion, store those values and swap in a different pair of values - then when they are dismissed, swap back to restore original values. Except this did not work, zero is cached, None is set when the invalid parameter is passed in; and that’s that, Min and Max are zero forever.

I’ve fixed this in a patch but since it’s FollowersScript, it is incompatible with anything. This fix should be made baseline.

The relevant lines in FollowersScript are:

Around line 606 - gets the HARDCODED values from the CK, and sets up two values to “cache the current value.” Actor in-game seems to get these values at this stage.

Around line 1070 - this is where the values get swapped on acquire / dismiss.
Line 1102: I believe the function
— ;IDLE CHATTER - set them back
CompanionActor.SetValue(IdleChatterTimeMin, CachedIdleChatterTimeMin)
CompanionActor.SetValue(IdleChatterTimeMax, CachedIdleChatterTimeMax)
— does not accept variables. It seems to set companions to 0 at this stage, going by getting values from actors in-game at various points before and after dismissal. I commented out this call entirely since I can’t think of any good reason to change this interval.

At line 1084 (companion acquire), instead of blindly cacheing what we assume is a valid value with no sanity checks, I just set:
— CompanionActor.SetValue(IdleChatterTimeMin, 600)
CompanionActor.SetValue(IdleChatterTimeMax, 900)

and then they STAY QUIET when dismissed, for at least 10 minutes and possibly up to 15 :P

I am attaching the copy of FollowersScript that I edited and commented.

At launch, the interval values were Min 600 and Max 900: 10-15 minutes between random lines. This seems rational. It remained at these values until Nuka-World, which for some ungodly reason set Min and Max to 240 and 300 - meaning even if it worked, 4-5 minutes between the five random lines they say. If you fix this, I implore you to go with the original intended Vanilla default :).

Closed by  Arthmoor
May 06 2017 05:30 AM
Reason for closing:  Fixed
Additional comments about closing:  

Fixed for UFO4P 2.0.1.

Sclerocephalus commented on March 10 2017 05:38 AM

Believe it or not, but there's nothing wrong with the followers script. There's no problem in passing a variable for a float argument as long as this variable holds a float or integer value (which it does). Floats and integers can be cast into one another (and the compiler does an autocast in such cases). If there was a type mismatch issue of any kind, the script would not compile. It's that simple (honestly).

What's actually wrong here is that the actor values in question are zero by default for all follower NPCs. They have no values specified in the actors' stats tab, so the engine assigns them the default values (which are in fact zero). That is, the values do not become zero by an obscure error in the followers script (there are no errors on that script, at least not in the CompanionDataToggle function), they are zero because they always have been. You can check this by adding a timer event to either CompanionActorScript or WorkshopNPCScript (all followers are running those scripts) and let them print out the current values in regular intervals. They are zero at all times - except when an actor has joined the player. During that time, they are set at Min 240/Max 300. After dismissal, the cached values are reset (and they are zero, which is no surprise).

To fix this, you only have to make sure that the actor values get initialized with proper values when an actor joins the player for the very first time - or even better, to make sure that they get initialized at game start, because you actually don't want to 'fix' just the current follower, but all potential followers at once.

Solutions that do not require any additional operations (such as re-hiring and dismissal) to be carried out by the player are preferrable. Therefore, the followers script is actually the wrong place. A much better fix is provided by adding an OnLoad() event to CompanionActorScript to initialize the actor values. That script has all the properties you need already pre-defined, so you can check whether the actor in question is a current follower - and take care of him specifically by setting the cached properties on followers script to the new defaults (instead of setting them on the actor because they would be overwritten otherwise on dismissal).

This does the job, fixes all actors at once, does not require any additional operations by the player and is perfectly retro-active. Plus, it maintains compatibility with follower mods because it doesn't touch that script.

spacefiddle commented on March 10 2017 01:31 PM

Thank you, very detailed explanation. Didn't know that about the other script, which I'm guessing isn't touched by other mods much, or at all.

So it looks like it was meant to be using the 4-5 minute intervals while active as a companion, and a 10-15 minute interval while hanging around a settlement?

Sclerocephalus commented on March 10 2017 09:07 PM

There is no evidence whatsoever that a 10-15 minute interval was intended as default. Those values (i.e. Min 600/Max 900) don't exist anywhere in Fallout.esm nor on any script that modifies those actor values (I checked the entire script folder for FO4 and all DLCs for scripts that may modify them). Where did you get them from ?

spacefiddle commented on March 11 2017 12:31 AM

Travelling, will check when I arrive... I remember seeing them specifically at 600-900 pre-NW, and 240-300 post. Not in the ESM; they aren't hardcoded Global vars? I thought I saw the script try to pull those first (and fail).

spacefiddle commented on May 02 2017 10:29 PM

Sorry I haven't updated - I can no longer find the copy of the source code, I think I've overwritten it. An older copy of FollowersScript.psc had the values 600 and 900, around line 600. In the version of FollowersScript the CK had uncompressed after NW was released, they were the 240 and 300 values you see now. I can't find them anywhere else and my project folders are kind of a mess. I'm not sure if there's any way to check back to historical sources for earlier game versions, and I'm not sure why they'd have made the interval so short for Nuka-World (it's not like Gage has that many lines...).


Available keyboard shortcuts


Task Details

Task Editing