Jump to content

SetModelPathEx not working


EnforcedRedemption

Recommended Posts

Hi all,

 

First time poster so I hope I have done all this right. I am designing a mod for immersive health checking: you press a button, and your character raises his arm slightly to show the PipBoy (like looking at a watch on your wrist, but the PipBoy instead).

 

I want to be able to change the PipBoy glare texture path on the fly so it shows, basically, the stats menu on the in game PipBoy screen. This is all so I can remove the hud and have an in game way of checking player health, without the hud breaking my immersion (personal opinion, but yeah I really hate huds).

 

I have the animation working but can't figure out how to change the texture of just the Pipboy glare. So my idea was to have multiple .nif files with different glare texture file paths (modified using NifSkope). I can't figure out how to change between them though.

As the title suggests, I am trying to use SetModelPathEx (nvse) to change the model on the fly, but the PipBoy just retains its vanilla mesh .nif. I have tested the modified meshes and they work in game. I have looked around for information on the command, but I couldn't find much at all.

This is the code I've tried, with no errors raised in the GECK. I am using the latest NVSE, with GECK Extender. I am still quite nooby at geck scripting so forgive me for noob mistakes.

scn hudawayscript

ref PipBoyREF
string_var PipPath

Begin GameMode
	set PipBoyREF to PlayerRef.GetEquippedObject 6	
	let PipPath :=  "meshes\pipboy3000\HAMeshes\HAPipBoyHY.nif"
	PipBoyREF.SetModelPathEx $PipPath
	PlayerRef.CastImmediateOnSelf hudawayspell

End

Cheers guys for any suggestions! If there's a better way to achieve this, please feel free to share!

 

Edit 1: I've just discovered this is the wrong command to use. SetBipedModelPathEx seems to be the right one, but it doesn't work either.

let MyArray := PlayerREF.GetInvRefsForItem PipBoy
let rSelf := MyArray[0]
let rPath := "Meshes\pipboy3000\hameshes\HAPipBoyHY.nif"
rSelf.SetBipedModelPathEx $rPath, 0

This is what I've tried, with no success. I have used GetBipedModelPath, and that works. It even shows the updated path, but the model doesn't change in game, even after saving and loading. rSelf.Update3D didn't help. Not sure where to go from here.

 

Edit 2: I have done some more testing, and found that the command is actually working. But the pipboy doesn't update until I back out to the main menu and reload the save. It seems the in game model needs to be refreshed before the new model path is actually used. Any ideas, peoples? Apologies for this getting longer and longer.

 

Edit 3: Ok, after some more testing, I have found this command added by JIP NVSE; SetBipedModelPathAlt. This command works the way Ex should have.

SetBipedModelPathAlt PipBoy 0 $PipPath

The problem, still, is getting the model to update without having to reload a save. There is another command by JIP; ReloadEquippedModels. This does not seem to work for me so far, although adding it to my script I get the equipped sound, so something is happening with this command, it just doesn't actually update the model for the PipBoy. If anyone has used this command successfully, any help would be appreciated. Cheers!

Link to comment
Share on other sites

No experience with attempting this, BUT it appears to me in both function instances ("SetModelPathEx" and "SetBipedModePathEx") you are omitting the "Object:form" parameter. (I would expect that to be "Pipboy".) In neither case is it indicated to be "optional"; so that would be enough for it to fail.

You probably should also look at the GECKWiki "Checking if a Mod is affecting an Object" entry.

You may want to consider upgrading from "PowerUp" to the GECK Extender NVSE Plugin with the Optional "Patcher" to make GECK 4GB aware and auto load NVSE. (Do not use together with GECK Powerup (nor the Forked version), which it replaces.) It restores more error messages and dumps them to a log file.

-Dubious-

Link to comment
Share on other sites

Just a quick one,

 

It appears adding an object id (in this case, Pip Boy, but I also tried other armors) at the end of the SetBipedModelPathEx command crashes the Geck when you try to save the script. This only happens with Geck Extender, but without it the script won't save. All this happens with or without a reference at the start.

Cheers.

Link to comment
Share on other sites

That is something I would report to RoyBatterian regarding the GECK Extender on it's comments page. He is also likely to be able to tell you what you are doing wrong with that function; if it is even possible. (The Extender is his baby, and he's on both the NVSE team and the GECKWiki admins.)

 

"Object:form" is a syntax term which I do not personally find to be "well defined". They have finally added the "Glossary" page link to the main GECKWiki page index, but that (and other parameter terms used in syntax examples) is not defined. (The "Glossary" was last updated in 2011.) I suspect from your experience that they are meaning a "BaseID" instead of a "Reference ID" as defined there.

 

-Dubious-

Link to comment
Share on other sites

You could try Unequip / Equip , or remove / add , then equip again. See if that will show the new model path.

Something done just before you raise the arm , so as not to notice .

 

Or possibly instead of swapping the model path on the fly ... you duplicate a bunch of pipboys with each model path. Then swap them out , just a thought in ncase ...

Link to comment
Share on other sites

Hey peeps,

Just a follow up from Mktavish's suggestion. Apparently equipping the PipBoy (or a copy of the PipBoy) in GameMode causes the game to crash. You can get around this by doing it in MenuMode, but that won't work in my instance as it'll break up normal gameplay for no reason.

It looks like using SetBipedModelPathAlt with ReloadEquippedModels (both from JIP NVSE plugin) is the right path, or at least would be if ReloadEquippedModels actually worked. Has anyone had any experience with ReloadEquippedModels?

 

Cheers.

Link to comment
Share on other sites

It may be because the pipboy is not flagged as playable , or some other reason with that specific slot.

Makes ya wonder if the glove is integral to it working properly ???

 

But back to my work around , you can avoid the crash with a script like thise ...

 

~~~~~~~~~~~~

SCN zzzPipSwapScript
Int iSwap
Begin GameMode
If IsKeyPressed 35
Player.RemoveItem PipBoy 1 1
Player.AddItem zzzPipBoy 1
Set iSwap to 1
If iSwap == 1
ShowSleepWaitMenu 1
endif
endif
End
Begin MenuMode 1012
If iSwap == 1
Player.EquipItem zzzPipBoy 1 1
Con_CloseAllMenus
endif
End
~~~~~~~~~~~~~~~
This was on a quest script set to .1 script delay ... which you were able to see the menu flash.
But an object script being able to run at the frames per second ... may be able to be unnoticeable ?
And I didn't bother , but could set another variable in the MenuMode that would then play the raise arm animation in the GameMode block.
Link to comment
Share on other sites

Hey Mktavish,

Cheers again for the help. I've been able to get it working using similar code from this thread.

https://forums.nexusmods.com/index.php?/topic/5185235-pipboy-equippimg-problem/

This has allowed me to utilize SetBipedModelAlt (JIP NVSE). This is my code, which runs in a spell script effect. I've noticed this not to be too reliable though.

 

When I press H, it will all work fine, but pressing U to lower and change everything back, it'll unequip the PipBoy but won't re-equip it, leaving a void in the player's arm. Sometimes this situation will reverse and when I press H it'll unequip the PipBoy but won't re-equip it. I think it has something to do with it being in a spell script, but not sure.

scn hudawayeffectscript

ref PipBoyREF
string_var DEFPipPath ;default PipBoy model path
string_var PipPath ;new PipBoy model path
int HACheck

Begin GameMode
    let DEFPipPath := "pipboy3000\pipboyarm.nif"

    if IsPC1stPerson

            if IsKeyPressed 35 && HACheck == 0
                let HACheck := 1
                Player.UnequipItem PipBoy 0 1
                let PipPath := "pipboy3000\HAMeshes\HAPipBoyHY.nif"
                SetBipedModelPathAlt PipBoy 0 $PipPath
                Player.srm
                Player.EquipItem PipBoy 0 1
         ResetPipBoyManager
         con_closeallmenus
                PlayerREF.PlayIdle HACheckPiPIdle
                
            endif

            if IsKeyPressed 22 && HACheck == 1
                let HACheck := 0
                Player.UnequipItem PipBoy 0 1
                let PipPath := $DEFPipPath
                SetBipedModelPathAlt PipBoy 0 $PipPath
                Player.srm
                Player.EquipItem PipBoy 0 1
         ResetPipBoyManager
         con_closeallmenus
                PlayerRef.StopIdle
                
            endif
    endif
End 

Getting closer though. When it works, it works well. I think your idea of having multiple PipBoy copies might be a better way of doing this, rather than changing the model over and over. I might give that a go now. Cheers!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...