Jump to content

[LE] Change weapon Model or Texture "on the fly" via Script


Rikushai

Recommended Posts

Hey there. i'm trying to realize a script that changes the texture (or the Nif-file) of an equipped Weapon during combat.

 

To find the right events and conditions isn't really the problem and are already there.

 

The problem is the Changeing.

 

i tryed already a few things.

 

SetModelPath() << changes only the world-model . The change is only seeable when i toss the weapon to the ground. Thats not that useful. xD

SetNodeTextureSet() << is not compatible with weapons. but only for ObjectReference - properties.

 

i tryed to convert the Weapon-property to an ObjectReference, what of course resulted in a Compiling Error.

So i converted the Weapon Property into a Form Property and the form property to an Object Reference Property

 

well that fixed the compiling error, but didnt work ingame (i guess there where propertys lost that are incompatible between weapon and Object-reference.

 

so has anyone a Idea how to actually realize such a script? or can at least direct me into the right direction?

Link to comment
Share on other sites

I have already answered your MSG about "Changing Text".


As for changing the "Model" you can just:

Remove Item (old weapon)

Add item (new weapon)


* Sometimes the simplest solutions are the best one...

Link to comment
Share on other sites

yes that was an idea that i had too, but there comes the Pull/sheath weapon animation in between thats totally disfunctional at least for that what i've planned^^

 

btw i was unsure if youre still active here ^^ Thats why i writed this post.^^

 

i will read your Pn, thanks at first for your efford :)

Edited by Rikushai
Link to comment
Share on other sites

ive found out, that the actual used equipped Model of the wapon not the weapon type object is, but the 1stperson_blah< model. that is actually a object reference so i can try my first try again...^^. Now i try to change the textureset there. I write back, if it works xD

 

mhrmhr okay first of all a little step in the right direction.. nja maybe. i can change the texture so as i want but only on a specific 1stperson model, placed somewhere in the world now i try to figure out how to speak to the entire Object in ck. not just the one that is placed somewhere. at least is that at the moment my closest idea.^^

 

update: Okay after messing around the entire day and with the help of Maxarturo, ive came to a result:

Its pretty much impossible to change the model/texture of an equipped item without re-equipping it. Thats pretty bad because with the need of re-equipping i cant use the script :/

 

with equipped items works SetNthTexturePath() as best. But how i sayed. It needs unequip/equip the items to show the changes.

if someone has still an idea - tell me please but if not .. well i guess i have to adjust my plans a bit.

Edited by Rikushai
Link to comment
Share on other sites

The specific SKSE functions on EQUIPPED ITEMS works only when you unequip and equip the item, that's why i told you to add an "Update Texture Function".


I personally couldn't find a workaround to this issue that's why i removed them, but in my case it turned out to be for good... it gave me a much better idea in the end !.


Have a happy modding !...

Link to comment
Share on other sites

Yah i know ^^ not that i didnt trust you - i just tryed anything out any way you mentuened and any other that ive found too.

 

btw SetEquippedModel() worked even better and was pretty simple to use - but also there: needed a refresh. So also not helpful.

So actually whould be the only possible way to get that realized is reequip a weapon without the delay and without playing the animation - but i guess thats not something that whould the creation engine whould allow :D

Link to comment
Share on other sites

Hey, I thought of a work around. The SetModelNthTextureSet(TextureSet texture, Int n, Bool firstPerson, Bool female), does work for ArmorAddons. So, what you could do, is make your weapon into an armor. On the actual weapon set it to NullTextureSet to make it invisible. Then you can use SetModelNthTextureSet on your Armor Weapon, and use .QueueNiNodeUpdate() after and the textures should change. I use SetModelNthTextureSet in my Jewelry Limiter mod so I know it works. The disadvantage of doing this is you have to use an extra armor slot when equipping the weapon.

Link to comment
Share on other sites

sounds good try-worthy but is a weapon even as armor even useable? i whould guess that the ck will return a "not compatible" error upon compiling :o

 

the 'workaround' that i try at the moment is to realize the texture change with an weapon-enchantments - basicly overlay the old texture with the new one if that whould work - it whould be a good step in the right direction, then i can test, if script-enchantment-apply also need a refresh xD if no - perfekt.. if yes.. well then i have at least half of the visual stuff realized that i've planned ^^

Link to comment
Share on other sites

The enchantment method might work to and would probably be better cause it doesn't require an extra armor slot. If that doesn't work though you can make anything into an armor. You have to make a new nif though of your weapon, and put it in the right position in the hand. You can import the MaleHands nif as a reference into outfit studio. Then import your weapon nif, position it, and weight the entire weapon to 1 node in the hands nif, I recommend the index finger. I did something similar with food meshes for the animated eating portion of my mod Take And Equip or Use for F04.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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