GetTraitForm

From GECK
Jump to: navigation, search


A function added by the pp NVSE Plugin.

Description

FormTraits are a more specialized version of Auxiliary-Variable variables that support nested arrays. Traits can be loaded directly onto forms when the game starts through Devkit, and they're especially useful for modification systems. linkedForm, linkedKey and Priority are all optional. linkedKey is mainly used if you want to have a linkedForm that can have multiple different values depending on the key.

Syntax

[help]
(variable) GetFormTrait Index:int parentForm:ref Key:string linkedForm:ref linkedKey:ref Priority:int

Example

let sString := GetFormTrait 0 weapNV9mmPistol "MoveNode"
let fx := GetFormTrait 1 weapNV9mmPistol "MoveNode"
let fy := GetFormTrait 2 weapNV9mmPistol "MoveNode"
let fz := GetFormTrait 3 weapNV9mmPistol "MoveNode"

Returns MoveNode trait on the weapNV9mmPistol

let fx := GetFormTrait 0 weapNV9mmPistol "ADSNode" SomeModifierForm "null" 1
let fy := GetFormTrait 1 weapNV9mmPistol "ADSNode" SomeModifierForm "null" 1
let fz := GetFormTrait 2 weapNV9mmPistol "ADSNode" SomeModifierForm "null" 1

Retrieves the linked trait "MoveNode" on weapNV9mmPistol, relative to SomeModifierForm. If SomeModifierForm has the trait ADSNode specifically for the weapNV9mmPistol, those values will be used. If not, then the trait values on weapNV9mmPistol are used.

let sModelPath := GetFormTrait 0 weapNV9mmPistol "AttachedModel" ModNV9mmPistolExtMags "MagSlot" 2

Retrieves the linked trait "AttachedModel" on weapNV9mmPistol, relative to ModNV9mmPistolExtMags in the MagSlot. If weapNV9mmPistol has a linked trait AttachedModel specifically for ModNV9mmPistolExtMags inside the "MagSlot" it will return that version of the model. If there is no linked trait, it will use the base trait on ModNV9mmPistolExtMags -Equivalent to calling:

if eval GetFormTraitType 0 weapNV9mmPistol "AttachedModel" ModNV9mmPistolExtMags "MagSlot" == -1   ;Trait does not exist

   let sModelPath := GetFormTrait 0 ModNV9mmPistolExtMags "AttachedModel"

else

   let sModelPath := GetFormTrait 0 weapNV9mmPistol "AttachedModel" ModNV9mmPistolExtMags "MagSlot"

endif

;Do something with sModelPath
Priorities Description
default 0 Returns only the link trait.
1 If the linked trait is not valid, the base trait of the parentForm is returned instead
2 If the linked trait is not valid, the base trait of the linked trait is returned instead

Notes

  • Traits remain valid for the session, and behave like the Temporary-Public class "*_" in aux variables.

See Also