Background for Skyrim SE
Member of the Form script
voidfunctionSetWorldModelPath(stringpath)Native

Description

Wiki Description

Sets the world model of the form. (This function requires SKSE)


Caveats

CK Wiki - Notes

  • This function can only be applied to items that actually have a 'physical/visual' world model.
  • This will affect all instances of the passed form.
  • World Model changes will not be saved and must be maintained via a maintenance setup or something similar.
  • In order to make it work, you'll need to use / (slash) instead of \ (backslash)

Parameters

stringpath

CK Wiki Description

the new world model for this form.


Examples

; Set 1st person iron sword static to use 1st person elven sword static world model, emerging from Data/Meshes
1stPersonIronSword.SetWorldModelPath("Weapons/Elven/1stPersonElvenSword.nif")
; Iron sword's now using the Elven sword world model!
; example on how to set up maintenance code in order to replace world model on loading a game, with the one applied before saving the game
; this example uses SkyUI menu option to replace world models via MCM menu
; as long as you did not place any objects in the game world while executing SetWorldModelPath in any of your scripts, you don't necessarily need maintenance code
Function MaintenanceSection()
    
        SetMenuOptionValue(MarkerModel, MarkerList[MarkerModelIndex])
    If MarkerModelIndex == 0
               ; do stuff 
    ElseIf MarkerModelIndex == 1

        Int iIndex = MTW_WayStoneFormList.GetSize(); get all ObjectReferences of base object via array
        While iIndex
            iIndex -= 1
            ObjectReference WaystoneRef = MTW_WayStoneFormList.GetAt(iIndex) as ObjectReference
            Utility.Wait(0.25); script latency troubleshoot
            WaystoneRef.disable(); needs to be disabled and reenabled in order to properly work on already plaaced instances in the game world
            MTW_Sign01.SetWorldModelPath("PointOfInterest/NorHitchPost01.nif")    
            WaystoneRef.enable(); don't forget to reenable
        EndWhile
            
    ElseIf MarkerModelIndex == 2
               ; do stuff
    EndIf
        
EndFunction

Auto-Generated Example

string myString__path

myForm__toCallFunctionOn.SetWorldModelPath(myString__path)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.