SetModelPath - ArmorAddon

From the CreationKit Wiki
Revision as of 11:22, 20 September 2013 by imported>Loop not defined (Added)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SKSE Member of: ArmorAddon Script

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

Syntax

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

Parameters

  • 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 Value

None.

Examples

; Change all Ebony Armor (cuirass) to appear as Orcish Armor
ArmorAddon orcishCuirassAA = (Game.GetForm(00013957) as Armor).GetNthArmorAddon(0)
string FilePath = orcishCuirassAA.GetModelPath(false, false) ; Get Orcish Armor file path
ArmorAddon ebonyCuirassAA = (Game.GetForm(00013961) as Armor).GetNthArmorAddon(0)
ebonyCuirassAA.SetModelPath(FilePath, false, false) ; Set Ebony Armor file path to Orcish Armor
; 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

Notes

  • 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.

See Also