Fallout 4

The core of the Alias Framework is a quest, which has a script that is called by a magic effect from an NPC. This magic effect is set up with a selection of Messages, or Formlists of Messages (or nested formlists of formlists of messages).

On the quest, there is a selection of aliases which are name replacement tokens, e.g. <name1><name2><name3>, with a script that assigns Message records to replace each <name> field. The quest contains the renaming script, which is called from a 2nd short spell on each NPC- this is where the variables used in the renaming are assigned. This spell is applied to NPCs using SPID.

On the magic effect applied by the spell there is an Array of a data struct. The script will iterate through each entry, and use it to pick a message. The Struct looks like this.

Struct NamesDatum
int percentNone ; chance to skip entirely
Message name ; static override name, if set will always use
float selectBylevelMax ; if set, will assign the namesList statically by level, instead of randomly
FormList namesCache ; used to pull random names from
FormList namesList

Message prefix ; if set will always use
Message suffix ; if set will always use
endStruct


Not all the fields need to be set. The script follows the following steps, and if any step successfully assigns a name for this index, it will finish and skip to the next index.

Checks percentNone, if it's set it generates a random chance that this index will be skipped entirely
It will then checkĀ Name, if it's set it will assign that
It will then check selectByMaxLevel, if that is set it will get the NPCs level, and use that to determine which name from NamesList to use, I use this for Ranks.
It will then check NamesCache, if that is set it will create a cache of the values in Nameslist, and use that cache to assign non-repeating names
Last, if nothing else is set will just randomly pick a name from NamesList

Prefix and Suffix are additional, static names that will always get assigned if they're set, added either before or after the name for this index. I use these mostly for static linkers to join things up e.g " of the ", or even just adding a space between first and last names.

The other variable that can be set on the script isĀ reqPartialNameFilter. This is used for example in the Raider plugin, to make sure we're not renaming NPCs that already have names. By setting this to "aider", we make sure that any NPC we're targeting has "aider" in their base name. I use "aider" instead of "Raider", because Fallout 4 has problems with capital letters and string comparisons. The isUnique = 0 condition on the spell prevents most of the unique NPCs being renamed, but unfortunatly some of the vanilla raider bosses aren't tagged as uniques, so this is an additional filter. Don't use if if you don't have to, doing a lot of string comparison is computationally expensive, and adds load to the script engine.

Article information

Added on

Edited on

Written by

WhiskyTangoFawks

0 comments