Calling an alternate texture through Papyrus scripting

Post » Sun Dec 14, 2014 10:46 am

I've been learning quite a bit about TESV modding in the last few weeks. One of the things I learned while doing tests with textures is that a texture with a mapped transparancy will show the transparent parts regardless of the actual mesh shape.

I've been able to change the shape of the teeth through pure texture editing. This is great because it keeps it super compatible with end users as long as their race uses the default mouth parts and texture paths.

Recently I made a RaceMenu plugin that added some warpaints. I noticed he used a syntax to load the paints into his menus. I also noticed when making the paints that I was able to replace the file, refresh the menu, and see the new results. You can also see this type of behavior with Armor/Clothing textures through equip/unequiping the item as the game reloads and polls the texture from the data folder every time it is equipped.

So this gave me an idea overall that it should be able to call a texture from a seperate directory to act as a temporary replacer.

For example teeth textures for humans are kept in :

Data/Textures/Actors/Character/Mouth/mouthhuman.dds

So it should be theoretically possible to have a script call a "replacer" texture being kept in the mods folder for example:

Data/Textures/TeethMod/TeethType1/mouthhuman.ddsData/Textures/TeethMod/TeethType2/mouthhuman.dds

Now, I've thought of several ways this could be accomplished since the actor has to be "refreshed" for the effect to be seen.

  1. MCM Menu Toggle (To me this would be preferable as it causes the least clutter though it requires the user to have SkyUI)
  2. A custom spell effect (Which should refresh the user on cast.)
  3. An OnEquip script tied to an item such as a ring (Mod's like Halo's Poser use this type of script to call animations so it should also be possible to call a texture I'd think.)

So my conundrum is this:

What is the actual synthax to call the texture from a file path string to apply it?

I'd assume to run the MCM menu you'd build the menu as one script, then have another which modifies an actor actually be applied. I've already built a basic MCM menu with a toggle State setup but am unsure how to proceed from here. If the menu can not be explicitly used to swap the texture and it still requires the use of a Custom Spell or OnEquip script; then could the MCM be made to toggle the actual path of the spell/item so that there would only be one needed to achieve the effect with the MCM deciding which texture is shown?

This idea is pretty proof of concept and could be applied to quite a few situations outside of just have multiple customised teefs.

Any help would be appreciated, thanks!

User avatar
Anna Watts
 
Posts: 3476
Joined: Sat Jun 17, 2006 8:31 pm

Post » Sat Dec 13, 2014 8:42 pm

I think you can edit texture paths now with some of the SKSE 1.7.1 functions

First you'll have to use some Form functions on your armor/weapon/item/etc in order to get it's TextureSet:

; Returns whether this Form has a World Model (fast)bool Function HasWorldModel() native; Returns the world model path of this Form, if it has a world modelstring Function GetWorldModelPath() nativeFunction SetWorldModelPath(string path) native; Returns the number of texture sets the world model has, if its textures can be swappedint Function GetWorldModelNumTextureSets() native; Returns the Nth texture set of the world model, if the textures can be swappedTextureSet Function GetWorldModelNthTextureSet(int n) native; Sets the world models Nth texture set, if the textures can be setFunction SetWorldModelNthTextureSet(TextureSet nSet, int n) native 

After you get the TextureSet using GetWorldModelNthTextureSet, you can then use http://www.creationkit.com/TextureSet_Script to edit the filepath.

User avatar
jenny goodwin
 
Posts: 3461
Joined: Wed Sep 13, 2006 4:57 am


Return to V - Skyrim