SetModelPath - ArmorAddon

Revision as of 17:02, 29 September 2013 by imported>Loop not defined (→‎Examples: added hex notations to first example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

SKSE Member of: ArmorAddon Script

Sets the file path for the nif file representing the equipped model of the armor. (This function requires SKSE)

SyntaxEdit

string Function SetModelPath(string path, bool firstPerson, bool female) native

ParametersEdit

  • path: The file path for the .nif file you want to change to.
  • firstPerson: Whether to set the file path of the biped armor model (false) or first person armor model (true).
  • female: Whether to set the file path of the male armor model (false) or female armor model (true).

Return ValueEdit

None.

ExamplesEdit

; Change all Ebony Armor (cuirass) to appear as Orcish Armor
ArmorAddon orcishCuirassAA = (Game.GetForm(0x00013957) as Armor).GetNthArmorAddon(0)
string FilePath = orcishCuirassAA.GetModelPath(false, false) ; Get Orcish Armor file path
ArmorAddon ebonyCuirassAA = (Game.GetForm(0x00013961) as Armor).GetNthArmorAddon(0)
ebonyCuirassAA.SetModelPath(FilePath, false, false) ; Sets Ebony Armor model path to Orcish Armor .nif file
; NOTE: Only affects male actors in 3rd person view


; Set the ArmorAddon nif file for any armor removed from a container
; Assumes the first four strings already have values, see GetModelPath - ArmorAddon example
string mFilePathPOV
string mFilePathBiped
string fFilePathPOV
string fFilePathBiped

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
   if akBaseItem.GetType() == 26 ; If item is Armor
      ArmorAddon tempAA = (akBaseItem as Armor).GetNthArmorAddon(0) ; 0 = first, 1 = second, etc.
      tempAA.SetModelPath(mFilePathPOV, true, false)    ; 1st person view, male
      tempAA.SetModelPath(mFilePathBiped, false, false) ; biped, male
      tempAA.SetModelPath(fFilePathPOV, true, true)     ; 1st person view, female
      tempAA.SetModelPath(fFilePathBiped, false, true)  ; biped, female
   endif
endEvent

NotesEdit

  • WARNING: Changing the file path of an ArmorAddon affects all armor using it!
  • This is to set the nif file of the equipped model on an actor. Use SetModelPath - Armor to set the nif file of the armor as it appears on the ground.
  • Remember that this function sets string values for ArmorAddon objects, not for Armor objects. You can use GetNthArmorAddon on Armor objects to quickly retrieve ArmorAddon objects, however.
  • Graphical glitches can result if the target ArmorAddon and the source ArmorAddon do not use the same Biped Objects.
    • Example: Changing IronHelmetAA (Biped: 31 & 43) to use the model path from EbonyHelmetAA (Biped: 30) will result in a bald character wearing no helmet.

See AlsoEdit