Difference between revisions of "Template:NifSE Example"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
(should have more dollar signs)
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
     if ( playerWeapon )
     if ( playerWeapon )
       let filepath := NifGetOriginalPath nifID
       let filepath := NifGetOriginalPath nifID
       SetModelPath filepath playerWeapon
       SetModelPath $filepath playerWeapon
       NifClose nifID
       NifClose nifID
     endif
     endif
Line 19: Line 19:
     let nifID := NifOpen $filepath 1
     let nifID := NifOpen $filepath 1
     let filepath := NifGetPath nifID
     let filepath := NifGetPath nifID
     SetModelPath filepath playerWeapon
     SetModelPath $filepath playerWeapon
   endif
   endif
   
   
Line 25: Line 25:
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. From here, one would presumably have further blocks dedicated to determining when to apply various changes using the other NifSE functions.<noinclude>
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. From here, one would presumably have further blocks dedicated to determining when to apply various changes using the other NifSE functions.<noinclude>


[[Category:NifSE|!Example]]
[[Category:NifSE|!!Example]]
[[Category:Templates|NifSE Example]]
[[Category:Templates|NifSE Example]]
[[Category:Function Info Templates|NifSE Example]]
[[Category:Function Info Templates|NifSE Example]]
</noinclude>
</noinclude>

Latest revision as of 09:42, 10 February 2015

An example script used in several places covering the basics of using NifSE.

Example

As an example of using NifSE, consider this code:

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

End

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. From here, one would presumably have further blocks dedicated to determining when to apply various changes using the other NifSE functions.