Difference between revisions of "NifOpen"

793 bytes added ,  11:04, 25 April 2010
no edit summary
imported>DragoonWraith
imported>DragoonWraith
Line 5: Line 5:


Opens a .nif 3D mesh file for reading, or if the optional bool is true, editing. Returns a unique identifier which may be passed to other NifSE functions in order to refer to the mesh.
Opens a .nif 3D mesh file for reading, or if the optional bool is true, editing. Returns a unique identifier which may be passed to other NifSE functions in order to refer to the mesh.
== Example ==
ref playerWeapon
string_var filepath
short nifID
[...]
Begin GameMode
  if ( playerWeapon != player.GetEquippedObject 16 )
    if ( playerWeapon )
      let filepath := NifGetOriginalPath nifID
      SetModelPath filepath playerWeapon
      NifClose nifID
    endif
    let playerWeapon := player.GetEquippedObject 16
    let filepath := GetModelPath playerWeapon
    let nifID := NifOpen filepath 1
    let filepath := NifGetPath nifID
    SetModelPath filepath playerWeapon
  endif
Every time the player equips a new weapon, creates a copy of the weapon's model that can be edited using NifSE, and sets the weapon's model to the copy. If a previous weapon had been affected, sets that weapon's model back to its original file, and closes that nif in NifSE.


== Notes ==
== Notes ==