Changing tree modelstextures dynamically

Post » Sat Oct 15, 2016 6:00 am

What I'm playing with is using a couple of rarely used OBSE commands - SetModelPath and SetTexturePath - to alter the look of every instance of some objects in the game. Right now I'm doing trees (which I'm not sure the command are designed for, but it does mostly work). The sort of thing you do is this:



TreeSugarMapleFreeSUREF.SetModelPath "\TreeSugarMapleFreeFA.spt"

TreeSugarMapleFreeSUREF.SetTexturePath "TreeSugarMapleLeavesFA.dds"

TreeSugarMapleFreeSUREF.Disable

TreeSugarMapleFreeSUREF.Enable



The initial REF is a single persistent instance of the tree. Redirecting its paths, then enable/disable, amazingly, redirects all other instances in the game. Funny way of doing things...



...but it does work, with a whole bunch of caveats, which I'm hoping someone might have some insight into.



Basically, the save game cannot hold this path info, so it is necessary to refresh every model/texture when GetGameLoaded==1. No way round this, and only a small delay, but behaviour can be erratic.



First, the close-up leaves (governed by SetTexturePath) and VWD billboards (SetModelPath) will not refresh for the worldspace you have loaded. I suspect there is no way round this, so I have added an isininterior check. If anyone knows a workaround, please let me know, though. (Update3D won't do it, this only affects the REF instance).



Having done that, the close-up models have usually updated themselves when you rerenter the worldspace, though this is a little erratic. As with the bigger problem with VWD, this is guaranteed with the first load of the session, but may or may not work with subsequent loads. (The game seems to be carrying data from previous loads, which is just wrong...)



That bit, I think is livable with, if annoying. But the biggest problem is with the VWD billboards, which update or not on a whim. They are also more likely to update on the first load of a session, though this is not guaranteed.



So is there any way to trigger a VWD reset from script? I've had the game do this on me spontaneously, but I can't see any way to make it happen. Oh, and I have tried the PurgeCellBuffers command. No effect.



I'd be grateful for any insights people may have into the above issues. (Oh, and I have ancillary questions about IsModelPathValid and the use of string variables instead of literals in this context, but those can wait.)




PS: Google shows these commands are hardly ever used. It's possible I've found out why...

User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Return to IV - Oblivion