Selecting .nif via script?

Post » Sat Feb 19, 2011 9:23 am

Is it possible to have a script update which .nif file an item uses instead of having to have multiple items built in the .esp?

Say I have a sword. The sword is supposed to change based on who is wielding it. Instead of having different copies of said sword, the script changes the effectiveness of the sword. However, it also is supposed to change what the sword looks like as well based on various conditions of who's wielding it.

Possible? Or if its not possible via the normal scripts, is there an OBSE plugin solution that could help with this?
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Fri Feb 18, 2011 9:09 pm

I believe the http://cs.elderscrolls.com/constwiki/index.php/SetModelPath command for OBSE is what you're looking for.
User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Sat Feb 19, 2011 6:13 am

I believe the http://cs.elderscrolls.com/constwiki/index.php/SetModelPath command for OBSE is what you're looking for.


Thank you very much. As a follow up:

[Ref.]SetModelPath "path string" [objectID]

Would the syntax of a real example look like:
' \weapons\mysword1.nif.SetModelPath "path string" objectID:foo12345 ' ?


And for an armor that would react the same way I found SetMaleBipedPath:
(nothing) reference.SetMaleBipedPath modelPath:string objectID:ref

Would the syntax of a real example look like:
' \armor\myarmor\myarmor1.nif.SetMaleBipedPath modelPath:string objectID:foo12345 ' ?

Sorry, I'm not very good with OB scripts, but I'd really like to make the mod, so any and all help is appreciated.
User avatar
Causon-Chambers
 
Posts: 3503
Joined: Sun Oct 15, 2006 11:47 pm

Post » Sat Feb 19, 2011 2:46 am

The reference (before the . ) will be a ref variable, that points to the item you want to change the model path on. (or, if this is a script ON the item, you can use its editor ID, or, do something like:

set self to getself

"self" would be declared as a ref variable in the script.)
User avatar
Wayne W
 
Posts: 3482
Joined: Sun Jun 17, 2007 5:49 am

Post » Sat Feb 19, 2011 11:16 am

So if the script were not on the object but on a separate token it would look like:

foo12345.SetModelPath "/weapons/mysword1.nif"

and

foo12345.SetMaleBipedPath "/armor/myarmor1.nif"

?

What is the extra "objectID:ref" appended to the end of the wiki examples?
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Fri Feb 18, 2011 9:51 pm

I think you can put the reference at either end of the statement.

but, the reference needs to be the item itself, not your character. You can use something like:

set item to ( player.getequippedobject 2 ) ; 2 is armor

and then do:

setmodelpath whateverpath item

use 16 for weapon. You will also want to put in a check to make sure that it is acting on the correct object...... under what circumstances do you want to swap model paths?
User avatar
Mike Plumley
 
Posts: 3392
Joined: Wed Sep 05, 2007 10:45 pm


Return to IV - Oblivion