Difference between revisions of "SetModelPath - ArmorAddon"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Loop not defined
(Notes: added graphical glitch details.)
imported>Loop not defined
m (→‎Examples: added hex notations to first example)
 
Line 22: Line 22:
<source lang="papyrus">
<source lang="papyrus">
; Change all Ebony Armor (cuirass) to appear as Orcish Armor
; Change all Ebony Armor (cuirass) to appear as Orcish Armor
ArmorAddon orcishCuirassAA = (Game.GetForm(00013957) as Armor).GetNthArmorAddon(0)
ArmorAddon orcishCuirassAA = (Game.GetForm(0x00013957) as Armor).GetNthArmorAddon(0)
string FilePath = orcishCuirassAA.GetModelPath(false, false) ; Get Orcish Armor file path
string FilePath = orcishCuirassAA.GetModelPath(false, false) ; Get Orcish Armor file path
ArmorAddon ebonyCuirassAA = (Game.GetForm(00013961) as Armor).GetNthArmorAddon(0)
ArmorAddon ebonyCuirassAA = (Game.GetForm(0x00013961) as Armor).GetNthArmorAddon(0)
ebonyCuirassAA.SetModelPath(FilePath, false, false) ; Sets Ebony Armor model path to Orcish Armor .nif file
ebonyCuirassAA.SetModelPath(FilePath, false, false) ; Sets Ebony Armor model path to Orcish Armor .nif file
; NOTE: Only affects male actors in 3rd person view
; NOTE: Only affects male actors in 3rd person view

Latest revision as of 16:02, 29 September 2013

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[edit | edit source]

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

Parameters[edit | edit source]

  • 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[edit | edit source]

None.

Examples[edit | edit source]

; 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

Notes[edit | edit source]

  • 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 Also[edit | edit source]