SetModelPathEx

From GECK
(Redirected from SetModelPathEX)
Jump to: navigation, search


Function Deprecated
This function should no longer be used. This page has been left for historical documentation purposes only.

This function has been deprecated as it is bugged, but is still preserved in its original state as multiple mods depend on its behavior. Use SetModelPath instead (not a typo, the original version was brought back and is simply more reliable).



A function added by the New Vegas Script Extender.

Description

Sets the file path to the NIF model for the specified ref variable containing a BaseForm. If a calling reference is used instead, its BaseForm is modified.

  • This change is NOT savebaked.
  • The file path is relative to ..\Data\Meshes\.
  • If the replaced model is already loaded, then it will need to be reloaded via functions like ReloadEquippedModels or Update3D.

Syntax

[help]
(none) reference.SetModelPathEx NewPath:string baseForm:refVar 

Example

This will set the model for all instances of GSSunnySmiles (the baseform of SunnyREF):

sunnyREF.SetModelPathEx "MyCoolMod\Creatures\SomeModelFile.NIF"

Bugs

Trying to pass an EditorID to the baseForm arg results in a compilation error. This happens due to the function supporting String Formatting and trying to have args that are placed after the format args, since all the format args are required to be variables, and an EditorID is not a variable.

When using this function with a base form, the script won't compile unless a formatted string with all possible 20 format variables is used before passing the base form. You can use an empty string variable for such, like so:

string_var s = ""
ref rVodka = Vodka
SetModelPathEx "MyCoolMod\Food\NewVodka.NIF%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z%z" s s s s s s s s s s s s s s s s s s s s rVodka

The following example compiles, BUT DOES NOT WORK:

ref rVodkaRef = Vodka
SetModelPathEx "MyCoolMod\Food\NewVodka.NIF" rVodkaRef

Indeed, the only method that works normally is passing a calling reference (where the function will use its baseform only).

See Also