Skip to content

Script commands

kNVSE adds the following commands to NVSE and GECK scripting.

  • Parameters in [brackets] are optional.
  • ref.Command requires a calling reference.
  • [ref.]Command accepts an optional calling reference that changes what the command targets.
  • KF paths are relative to Data\Meshes and must use backslashes (\), such as characters\_male\idleanims\myidle.kf. Most commands lowercase KF paths automatically.
Command Alias Purpose
ActivateAnim Start a KF directly on an actor
AddAnimTextKey Append a text key to a KF
BlendToAnim Blend from one KF to another
BlendToAnimFromPose Blend from the actor’s current pose to a KF
CanFireWeapon Check if an actor can fire right now
CopyAnimationsToForm Copy a form’s registered overrides to another form
CopyAnimPriorities Copy bone priorities from one loaded KF to another
CreateIdleAnimForm Create an idle form for a KF path
CrossFadeAnims Cross-fade from an active KF to another KF
DeactivateAnim Stop a playing KF
EjectWeapon Eject a shell casing from the equipped weapon
EraseCurrentAnimAction Clear the actor’s current animation action
ForceFireWeapon Make an actor fire its equipped weapon
ForcePlayIdle Play an idle form immediately
ForceStopIdle Stop the actor’s currently playing idle
GetActiveAnims Get paths of all active KFs on an actor
GetAnimationAttributes GetAnimAttrs Get a string map of a KF’s properties and state
GetAnimationsByAnimGroup GetAnimsByGroup Get KFs an actor can play for an anim group
GetAnimCurrentTime Get the current playback time of a KF
GetAnimHandType Get the weapon hand type ID of a KF
GetAnimInterpPriority Get a single bone’s priority in a KF
GetAnimMovementSpeedMult Get an actor’s movement animation speed multiplier
GetAnimPathBySequenceType GetAnimPathByType Get the KF path playing in a sequence slot
GetAnimTextKeyTime Get the timestamp of a text key
GetAnimWeight Get the weight of a loaded KF
GetDirectoryFiles List loose and BSA files matching a wildcard path
GetGlobalAnimTime Get an actor’s animation clock
GetkNVSESetting Read the active numeric value of a kNVSE setting
GetPlayingAnimBySequenceType GetAnimByType Get attributes of the KF playing in a sequence slot
GetPlayingAnimSequencePaths GetAnimsByType Get an array of KF paths across all 8 sequence slots
IsAnimAdditive Check if a loaded KF is marked additive
IsAnimPlayingAlt Check if an anim group is playing (any weapon type)
IsAnimQueued Check if a KF is queued via QueueNextAnim
IsAnimSequencePlaying Check if a KF is currently playing
kNVSEReset Reload override folders, JSONs, and KFs from disk
kNVSEToggleSetting Toggle a boolean kNVSE setting
PlayAnimationPath Play any KF file on an actor
PlayAnimSequenceEx Play an embedded NIF animation on any object
PlayGroupAlt Play an anim group matched to the equipped weapon
QueueNextAnim Queue a KF for the next play of its anim group
RegisterCustomAnimGroup Register a callback script for a custom anim group
RemoveAnimTextKey Remove a text key from a KF
SetActorAnimationPath Register overrides for an actor or globally
SetAnimAdditive Mark a KF as an additive animation
SetAnimAdditiveInterpsWeightMult Scale an additive KF’s strength per bone
SetAnimCurrentTime Set the playback time of a loaded KF
SetAnimCycleType Change a KF’s cycle type (loop/reverse/clamp)
SetAnimDestFrame Set a KF’s fDestFrame text key
SetAnimInterpPriority Set a single bone’s priority in a KF
SetAnimSequenceFrequencyAlt Set playback speed of an embedded NIF animation
SetAnimTextKeys Replace all text keys on a KF
SetAnimWeight Set the weight of a loaded KF
SetFormAnimationPath Register overrides for a form or form list
SetGlobalAnimTime Set an actor’s animation clock
SetkNVSESetting Change a kNVSE setting for the current session
SetWeaponAnimationPath Register overrides for a weapon
ThisAnim Get the KF path inside a text-key or custom-group script
ThisAnimDir Get the folder path of ThisAnim

Aliases can be used anywhere in place of the full command name.

  • First-person flag (firstPerson, bFirstPerson, bIsFirstPerson): Applies only to the player, who uses separate 1st-person and 3rd-person skeletons. Pass 1 for 1st person or 0 for 3rd person. Where optional, this parameter defaults to -1 (use the player’s currently active camera view), except where noted. Ignored for NPCs.
  • Sequence type (sequenceId): The animation slot ID: 0 Idle, 1 Movement, 2 Left Arm, 3 Left Hand, 4 Weapon, 5 Weapon Up, 6 Weapon Down, 7 Special Idle.
  • Return values: Unless noted otherwise, commands return 1 on success and 0 on failure (such as a missing KF, invalid form, or non-actor reference).
  • Deferred execution on NPCs: When PlayAnimationPath, ActivateAnim, DeactivateAnim, CrossFadeAnims, BlendToAnimFromPose, QueueNextAnim, SetAnimAdditive, or SetAnimAdditiveInterpsWeightMult is called on an NPC during background AI updates, kNVSE queues the operation to run on the next frame and returns 1 immediately.

These commands register or disable animation overrides at runtime using the same override system as Data\Meshes\AnimGroupOverride. See Animation overrides for priority rules, variants, and conditions.

  • animationPath is relative to Data\Meshes. Pass either a single .kf file path or a folder path (a folder registers all .kf files directly inside it, loose or in BSAs, as one set).
  • enable 1 registers the files; enable 0 disables the override set containing those files.
  • Each call is logged to kNVSE.log with the calling script and plugin.
  • Returns 1 if at least one file was registered (when enable is 1) or matched and disabled (when enable is 0).
SetWeaponAnimationPath weapon:form firstPerson:int enable:int animationPath:string

Registers or disables overrides played when an actor equips weapon. Set firstPerson to 1 for the player’s 1st-person skeleton or 0 for 3rd-person skeletons.

SetWeaponAnimationPath WeapNV9mmPistol 1 1 "characters\_1stperson\mypistol"
SetWeaponAnimationPath WeapNV9mmPistol 0 1 "characters\_male\mypistol"
[ref.]SetActorAnimationPath firstPerson:int enable:int animationPath:string [pollCondition:int] [condition:form] [matchBaseAnimGroupId:int]

Registers or disables overrides for the calling actor. If called without a reference:

  • When firstPerson is 0, the override applies globally to all actors.
  • When firstPerson is 1, the override applies to the player (since only the player has a 1st-person skeleton).

Optional parameters:

  • pollCondition: 1 re-checks condition while looping animations play (default 0).
  • condition: A UDF script or lambda returning non-zero when the override should play.
  • matchBaseAnimGroupId: 1 matches all weapon, stance, and power armor variants of the base group (default 0).
playerRef.SetActorAnimationPath 0 1 "characters\_male\mymod\walk" 1 (begin function {}
SetFunctionValue (playerRef.IsSneaking == 0)
end)
SetFormAnimationPath form:form firstPerson:int enable:int animationPath:string [pollCondition:int] [condition:form] [matchBaseAnimGroupId:int]

Same options as SetActorAnimationPath, targeting form explicitly. form can be an actor reference, NPC or creature base form, race, weapon, or a form list of those types (including nested form lists). Form lists are expanded at the time of the call, so forms added to the list later are not covered.

SetFormAnimationPath MyRaceList 0 1 "characters\_male\mymod\idles"
CopyAnimationsToForm fromForm:form toForm:form

Copies all 1st-person and 3rd-person overrides registered directly on fromForm onto toForm. Returns 1 if at least one file was copied.

CopyAnimationsToForm WeapNV9mmPistol MyCustom9mmPistol
kNVSEReset

Console command for testing animation edits without restarting the game. Rescans Data\Meshes\AnimGroupOverride, reloads JSON configs, and clears cached KFs so modified files reload from disk on their next play. Overrides registered by scripts and plugins are preserved. Prints a warning if called from a script instead of the console. Always returns 0.

RegisterCustomAnimGroup name:string script:form [cleanUpScript:form]

Registers a callback script for a custom animation group (<animGroup>__<name>.kf inside a _male or _1stperson override folder).

While any animation from that same _male or _1stperson folder plays, script runs every frame on the actor with two arguments: the custom KF’s path (string_var) and whether it is 1st person (int). When that animation stops, cleanUpScript (if provided) is called once with the same two arguments.

Group names are case-insensitive. Returns 1 if registered, or 0 if invalid or if the exact same (script, cleanUpScript) pair is already registered.

RegisterCustomAnimGroup "Inspect" (begin function {string_var sPath, int iFirstPerson}
; runs every frame while an animation from the same folder plays
end) (begin function {string_var sPath, int iFirstPerson}
; runs once when the animation stops
end)
ref.PlayAnimationPath path:string [firstPerson:int]

Loads (if needed) and plays any KF file directly on the actor without needing an override or idle form. If the KF is already playing, it restarts from the beginning.

Non-looping KFs (Clamp or Reverse) stop automatically when they reach their end. Looping KFs continue playing until stopped (for example with DeactivateAnim).

playerRef.PlayAnimationPath "characters\_male\idleanims\myidle.kf"
ref.ActivateAnim animSequencePath:string [bIsFirstPerson:int] [iPriority:int] [bStartOver:int] [fWeight:float] [fEaseInTime:float] [timeSyncSequencePath:string]

Starts a KF directly with control over priority, weight, blend-in time, and synchronization. If the KF is already active, it is stopped and restarted.

  • iPriority: Sequence priority (default 0).
  • bStartOver: 1 starts from the beginning (default 1).
  • fWeight: Playback weight (defaults to the KF’s own weight).
  • fEaseInTime: Blend-in time in seconds (defaults to the KF’s Blend/BlendIn text key, or 0 if none).
  • timeSyncSequencePath: Optional KF path to sync playback timing with (fails if that KF is not found).
playerRef.ActivateAnim "characters\_1stperson\mymod\overlay.kf" 1 10 1 1.0 0.2
ref.DeactivateAnim animSequencePath:string [fEaseOutTime:float]

Stops a currently playing KF on the actor. fEaseOutTime is the blend-out time in seconds (defaults to the KF’s Blend/BlendOut text key, or 0 if none).

For additive KFs, DeactivateAnim stops the animation immediately without removing its additive flag. Calling ActivateAnim on it again still plays it additively.

playerRef.DeactivateAnim "characters\_1stperson\mymod\overlay.kf" 0.3
ref.CrossFadeAnims sourceSequencePath:string destSequencePath:string [bFirstPerson:int] [fEaseInTime:float] [iPriority:int] [bStartOver:int] [fWeight:float] [timeSyncSequencePath:string]

Cross-fades from sourceSequencePath (which must currently be active) to destSequencePath. Defaults match ActivateAnim, except fEaseInTime defaults to the blend time between the two KFs. Note that custom kNVSE text keys on destSequencePath do not automatically trigger from CrossFadeAnims.

playerRef.CrossFadeAnims "characters\_male\mtidle.kf" "characters\_male\mymod\pose.kf" 0 0.25
ref.BlendToAnim sourceSequencePath:string destSequencePath:string [bFirstPerson:int] [fDuration:float] [fDestFrame:float] [fSourceWeight:float] [fDestWeight:float] [iPriority:int] [timeSyncSequencePath:string]

Blends from sourceSequencePath to destSequencePath over fDuration seconds (defaults to the blend time between the two KFs), starting destSequencePath at fDestFrame seconds (default 0). Weights default to each KF’s own weight, iPriority defaults to 0, and timeSyncSequencePath optionally syncs timing to another KF.

playerRef.BlendToAnim "characters\_male\mtidle.kf" "characters\_male\mymod\pose.kf" 0 0.5 0.0
ref.BlendToAnimFromPose sequencePath:string [bFirstPerson:int] [fDuration:float] [fDestFrame:float] [iPriority:int] [timeSyncSequencePath:string]

Blends from the actor’s current pose into sequencePath over fDuration seconds (defaults to the KF’s blend time), starting at fDestFrame seconds (default 0). iPriority defaults to 0, and timeSyncSequencePath optionally syncs timing to another KF.

playerRef.BlendToAnimFromPose "characters\_male\mymod\pose.kf" 0 0.4
ref.QueueNextAnim sAnimPath:string [bFirstPerson:int]

Queues sAnimPath to play the next time its animation group plays on the actor, overriding normal selection for that one play. The KF must have an anim group, and it matches that exact group (including weapon type, sneak/swim stance, and power armor flags). Use IsAnimQueued to check if it is still queued.

playerRef.QueueNextAnim "characters\_1stperson\mymod\2hareloada_special.kf" 1
ref.ForcePlayIdle idle:form [pov:int]

Plays an idle form (TESIdleForm) immediately on the actor, bypassing its GECK conditions.

For the player, pov uses 0 for the current view (default), 1 for 3rd person, and 2 for 1st person. Ignored for NPCs.

playerRef.ForcePlayIdle MyCustomIdle 2
ref.ForceStopIdle [pov:int]

Stops the idle currently playing on the actor. pov uses the same values as ForcePlayIdle (0 current view, 1 3rd person, 2 1st person).

playerRef.ForceStopIdle 2
ref.PlayGroupAlt animGroup:animgroup [flags:int]

Plays animGroup on the actor while automatically applying the actor’s currently equipped weapon type (and stance). flags defaults to 1 (play immediately). Returns 1 if the group started playing.

playerRef.PlayGroupAlt Equip
CreateIdleAnimForm path:string [type:int]

Creates a runtime idle form pointing to path (relative to Data\Meshes). type is the sequence slot (0–7, default 7 for Special Idle).

ref.PlayAnimSequenceEx sequenceName:string [nodeName:string] [priority:int] [easeInTime:float]

Plays an embedded NIF animation sequence on any object reference (doors, activators, furniture, etc.). sequenceName is case-sensitive. Searches the model’s root node, or nodeName if provided. priority defaults to 0 and easeInTime defaults to 0.0. Returns 0 if the sequence is already active or not found.

MyDoorRef.PlayAnimSequenceEx "Open" "" 0 0.1
ref.SetAnimCurrentTime path:string time:float

Jumps a loaded KF on the actor to time seconds.

playerRef.SetAnimCurrentTime "characters\_male\mymod\pose.kf" 1.5
ref.SetAnimWeight animSequencePath:string weight:float

Sets the blend weight of a loaded KF on the actor. Requires a calling actor reference.

playerRef.SetAnimWeight "characters\_1stperson\mymod\breathing.kf" 0.5
ref.SetGlobalAnimTime timePassed:float [bFirstPerson:int]

Sets the actor’s animation clock in seconds, shifting all active sequences on that skeleton together.

playerRef.SetGlobalAnimTime 0.0 1
ref.SetAnimCycleType animSequencePath:string cycleType:int [firstPerson:int]

Sets how a KF behaves when it reaches its end: 0 loop, 1 reverse, 2 clamp (hold on the last frame). Loads the KF onto the actor if not already loaded.

playerRef.SetAnimCycleType "characters\_male\mymod\pose.kf" 2 0
ref.SetAnimDestFrame animPath:string destFrame:float [firstPerson:int]

Sets (or adds) the KF’s fDestFrame text key to destFrame seconds, controlling where the animation starts on its next BlendFromPose. Loads the KF if needed.

Note: firstPerson defaults to 0 (3rd person) and is treated as a boolean (0 = 3rd person, any non-zero value = 1st person). Do not pass -1 to mean current view.

playerRef.SetAnimDestFrame "characters\_1stperson\mymod\draw.kf" 0.35 1
ref.SetAnimAdditive additiveAnimPath:string [firstPerson:int] [referencePoseAnimPath:string] [referencePoseTimePoint:float] [ignorePriorities:int]

Marks a KF to play additively on the actor, applying its difference from a reference pose on top of underlying animations instead of replacing them.

  • referencePoseAnimPath: KF used as the baseline pose (defaults to the actor’s current idle animation).
  • referencePoseTimePoint: Timestamp in seconds to sample from the reference pose (default 0.0).
  • ignorePriorities: 1 applies the additive motion regardless of bone priorities (default 0).

Call SetAnimAdditive before starting the KF with ActivateAnim. The additive flag stays on that actor’s KF across subsequent plays.

playerRef.SetAnimAdditive "characters\_1stperson\mymod\breathing.kf" 1
playerRef.ActivateAnim "characters\_1stperson\mymod\breathing.kf" 1
ref.SetAnimAdditiveInterpsWeightMult animSequencePath:string rootNodeName:string weight:float recursive:int [firstPerson:int]

Scales the strength of an already-additive KF on rootNodeName (and all child bones under it when recursive is 1). The multiplier persists on the actor’s KF across future plays. Pass firstPerson explicitly (0 or 1) when calling on the player. Returns 0 if the bone is not found or the KF is not additive.

playerRef.SetAnimAdditiveInterpsWeightMult "characters\_1stperson\mymod\breathing.kf" "Bip01 L UpperArm" 0.5 1 1
[ref.]SetAnimInterpPriority sAnimPath:string sInterpName:string iPriority:int

Sets the priority (0 to 255) of a single bone (sInterpName, case-sensitive, such as "Bip01 Spine") in a KF.

  • With a reference: updates the KF already loaded on that reference.
  • Without a reference: updates the shared template KF, affecting actors that load it afterward (not copies already loaded on existing actors).
playerRef.SetAnimInterpPriority "characters\_male\mymod\wave.kf" "Bip01 R Clavicle" 60
ref.CopyAnimPriorities sSourceAnimPath:string sDestAnimPath:string

Copies bone priorities from sSourceAnimPath to sDestAnimPath for all matching bone names. Both KFs must already be loaded on the reference. Returns the number of bones updated.

int iCopied
let iCopied := playerRef.CopyAnimPriorities "characters\_male\mtidle.kf" "characters\_male\mymod\customidle.kf"
ref.SetAnimSequenceFrequencyAlt sequenceName:string frequency:float [nodeName:string]

Sets the playback speed of an embedded NIF animation sequence on an object reference (1.0 is normal speed). sequenceName and nodeName work the same way as in PlayAnimSequenceEx.

MyDoorRef.SetAnimSequenceFrequencyAlt "Open" 2.0
ref.IsAnimSequencePlaying path:string

Returns 1 if the KF is currently active on the actor and not easing out via DeactivateAnim (still returns 1 while cross-fading out). For the player, checks the current camera view first and only checks the other view if the KF is not loaded in the current view.

if playerRef.IsAnimSequencePlaying "characters\_1stperson\mymod\overlay.kf"
; still playing
endif
ref.IsAnimPlayingAlt animGroup:animgroup

Returns 1 if the actor is playing animGroup in its current view, regardless of equipped weapon type or hand variant.

if playerRef.IsAnimPlayingAlt ReloadA
; player is playing any weapon type's ReloadA
endif
ref.IsAnimQueued sAnimPath:string

Returns 1 if sAnimPath is currently waiting in the actor’s queue from QueueNextAnim.

ref.IsAnimAdditive animSequencePath:string

Returns 1 if the loaded KF on the actor is marked as additive (whether currently playing or inactive).

ref.GetActiveAnims [bIsFirstPerson:int]

Returns an array containing the paths of all currently active KFs on the actor.

array_var aAnims
let aAnims := playerRef.GetActiveAnims 1
ref.GetPlayingAnimSequencePaths [bIsFirstPerson:int]

Alias: GetAnimsByType

Returns an 8-element array (indices 0 through 7) containing the KF path playing in each sequence slot, or an empty string "" for empty slots.

array_var aSlots
let aSlots := playerRef.GetAnimsByType 1
string_var sWeaponAnim
let sWeaponAnim := aSlots[4]
ref.GetPlayingAnimBySequenceType sequenceId:int [bIsFirstPerson:int]

Alias: GetAnimByType

Returns a string map of attributes for the KF playing in sequence slot sequenceId (0–7), using the same keys as GetAnimationAttributes. Returns 0 if the slot is empty or out of range.

array_var aWeaponAnim
let aWeaponAnim := playerRef.GetAnimByType 4 1
if eval (aWeaponAnim)
float fTime
let fTime := aWeaponAnim["calculatedTime"]
endif
ref.GetAnimPathBySequenceType sequenceId:int [bIsFirstPerson:int]

Alias: GetAnimPathByType

Returns the path (string) of the KF playing in sequence slot sequenceId (0–7), or "" if the slot is empty.

string_var sWeaponAnim
let sWeaponAnim := playerRef.GetAnimPathBySequenceType 4
[ref.]GetAnimationAttributes path:string

Alias: GetAnimAttrs

Returns a string map describing a KF.

  • With an actor reference: inspects the loaded KF on that actor and includes live playback state keys.
  • With a non-actor reference: inspects the loaded sequence on that object (without playback state keys).
  • Without a reference: loads and inspects the KF file directly (without playback state keys).

Always included:

Key Description
sequenceName Path of the KF
seqWeight Blend weight
cycleType 0 loop, 1 reverse, 2 clamp
frequency Base playback speed
beginKeyTime, endKeyTime Start and end key timestamps
accumRootName Name of the root motion bone

Included when present on the KF:

Key Description
animGroupId, animGroupName Full 16-bit anim group ID and group name
sequenceType Sequence slot (0–7)
keyType Group action type
textKeyTimes, textKeyValues Parallel arrays of text key timestamps and strings

Included only on an actor reference:

Key Description
lastTime, weightedLastTime, lastScaledTime Internal timing values
state Sequence state (0 inactive, 1 animating, 2 ease-in, 3 ease-out, 4 trans-source, 5 trans-dest, 6 morph-source)
offset, startTime, endTime Sequence offset and transition bounds
calculatedTime Current playback time in the KF
multiplier Speed multiplier for the group (e.g. fire rate or reload speed; present when the KF has an anim group)
array_var aAttrs
let aAttrs := playerRef.GetAnimAttrs "characters\_1stperson\2hareloada.kf"
if eval (aAttrs)
Print "End time: " + $aAttrs["endKeyTime"]
endif
ref.GetAnimationsByAnimGroup animGroup:animgroup [bIsFirstPerson:int]

Alias: GetAnimsByGroup

Returns an array of KF paths the actor can play for animGroup with its currently equipped weapon. If enabled overrides exist for that group, returns the override paths; otherwise returns the vanilla KF paths for the group.

array_var aReloads
let aReloads := playerRef.GetAnimsByGroup ReloadA 1
ref.GetAnimCurrentTime path:string

Returns the current playback time (in seconds) of a loaded KF on the actor, or 0 if not found.

ref.GetGlobalAnimTime [bFirstPerson:int]

Returns the actor’s animation clock in seconds. See SetGlobalAnimTime.

ref.GetAnimWeight animSequencePath:string

Returns the blend weight of a loaded KF on the actor, or 0 if not found.

[ref.]GetAnimInterpPriority sAnimPath:string sInterpName:string

Returns the priority (0–255) of bone sInterpName (case-sensitive) in a KF, or -1 if the KF or bone is not found. Calling with or without a reference works the same way as SetAnimInterpPriority.

ref.GetAnimHandType sAnimPath:string

Returns the weapon hand type ID encoded in a loaded KF’s anim group (for example, one-handed pistol vs. two-handed rifle), or -1 if the KF is not found or has no anim group.

ref.GetAnimMovementSpeedMult

Returns the movement animation speed multiplier currently applied to the actor.

These commands read or modify KF text keys at runtime. Because KFs share their text key data across actors using the same file, changes affect all actors playing that KF. See Text keys for supported keys and limitations.

[ref.]SetAnimTextKeys animPath:string textKeyTimes:array textKeyValues:array [pointOfView:int]

Replaces all text keys on a KF. textKeyTimes (floats in seconds) and textKeyValues (strings) must have the same length. Uses NVSE expression syntax.

  • The KF must not currently be playing.
  • With an actor reference, loads the KF if needed. pointOfView: 1 = 3rd person, 2 = 1st person, 0 (default) = check already-loaded views, or load into 3rd person if unloaded.
  • Without a reference, loads the KF file directly.
  • If the engine fails to parse the new keys for the KF’s anim group, the previous keys are restored and the command returns 0.
playerRef.SetAnimTextKeys "characters\_1stperson\mymod\attack.kf" (ar_List 0, 0.4, 1.2) (ar_List "Start", "Hit", "End") 2
[ref.]AddAnimTextKey sAnimPath:string fTime:float sTextKey:string

Appends a text key at fTime seconds to a KF. With a reference, modifies the KF loaded on that reference; without a reference, loads the KF file directly. Refreshes kNVSE custom text keys, but does not re-parse vanilla engine keys (Start, Hit, End).

AddAnimTextKey "characters\_1stperson\mymod\reload.kf" 0.8 "SoundPath: fx\wpn\mymod\magin.wav"
[ref.]RemoveAnimTextKey sAnimPath:string iIndex:int

Removes a text key by index (0-based) from a KF. Looks up the KF the same way as AddAnimTextKey. Returns 1 on success.

ref.GetAnimTextKeyTime sAnimPath:string sTextKey:string

Returns the timestamp (in seconds) of the first text key matching sTextKey (exact, case-sensitive match) on a loaded KF with an anim group, or -1 if not found.

float fHitTime
let fHitTime := playerRef.GetAnimTextKeyTime "characters\_1stperson\mymod\attack.kf" "Hit"
ThisAnim

Inside a script triggered by a Script: or scriptLine: text key, or by RegisterCustomAnimGroup, returns the path (string) of the triggering KF. Returns "" everywhere else (including JSON override conditions).

ThisAnimDir

Returns the parent directory path (without a trailing backslash) of ThisAnim, or "" when called outside a text-key or custom-group script. Useful for loading sibling files next to the running KF.

string_var sSoundAnim
let sSoundAnim := ThisAnimDir + "\overlay.kf"

These commands read and change kNVSE.ini settings for the current session only (changes are not saved to kNVSE.ini).

Pass either the full INI key ("bBlendSmoothing") or its short name without the type prefix and optional Fix prefix ("BlendSmoothing", "SpineBlendBug" for bFixSpineBlendBug). Names are case-insensitive. See Settings for the full list of keys and when each takes effect:

  • Live and NewAnimations settings apply immediately (or for newly loaded animations).
  • RestartToEnable settings apply immediately when set to "0", and wait for a restart when turned back on ("1").
  • Restart settings keep their active value for the rest of the session; edit kNVSE.ini or use the in-game menu instead.
GetkNVSESetting sName:string

Returns the currently active numeric value of the setting (1 or 0 for toggles), or 0 if the setting does not exist or is a string setting.

if GetkNVSESetting "bBlendSmoothing"
; blend smoothing is active
endif
SetkNVSESetting sName:string sValue:string

Sets sName to sValue (passed as a string). For numeric settings, out-of-range values are clamped to the setting’s allowed range. For string settings (such as sLegacyAnimTimePaths), any string is accepted and applied immediately. Returns 1 if accepted, or 0 if the setting does not exist or a numeric setting received a non-numeric value.

SetkNVSESetting "bFixOverlappingBlends" "0"
SetkNVSESetting "fBlendSmoothness" "0.5"
kNVSEToggleSetting sFeatureName:string

Toggles a boolean (b*) setting and returns the active value (1 or 0) after toggling. Returns 0 for unknown or non-boolean settings.

kNVSEToggleSetting "OverlappingBlends"
ref.ForceFireWeapon

Forces the actor to fire its equipped weapon once.

playerRef.ForceFireWeapon
ref.CanFireWeapon

Returns 1 if the actor is currently allowed to fire its weapon (checking menu state, stagger, paralysis, knockout, sitting, death, active aim transitions, allowAttack, interruptLoop, and related weapon state checks), or 0 otherwise.

if playerRef.CanFireWeapon
playerRef.ForceFireWeapon
endif
ref.EjectWeapon

Ejects a shell casing from the actor’s equipped ranged weapon, matching the weapon’s Eject text key. Does nothing for melee or unarmed weapons. Always returns 0.

playerRef.EjectWeapon
ref.EraseCurrentAnimAction

Resets the actor’s current animation action (such as attack or reload) to none.

playerRef.EraseCurrentAnimAction
GetDirectoryFiles sPath:string [archiveType:int]

Returns an array of file paths matching the wildcard pattern sPath, searching both loose files and loaded BSAs. sPath is relative to the game folder (Data\ is prepended automatically if omitted), and returned paths keep the prefix you passed.

archiveType is an optional bitmask filtering which BSA types to search (default searches all): 1 meshes, 2 textures, 4 menus, 8 sounds, 16 voices, 32 shaders, 64 trees, 128 fonts, 256 misc.

array_var aFiles
let aFiles := GetDirectoryFiles "meshes\characters\_male\mymod\*.kf" 1