SetNthTexturePath()

Post » Wed May 11, 2016 11:21 am

Could someone give me an example on how to use this? The wiki entry is empty. Is it instant or does it need to be updated?


http://www.creationkit.com/TextureSet_Script



Edit: It needs to be updated. http://www.nexusmods.com/skyrim/mods/71810/?

User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Wed May 11, 2016 8:05 am

I don't know how much you know, so I'll start with the basics.



Let's say you have a set of forms that will use the same 3D model, but will use different textures. The models can specify pieces that can be reskinned, and the forms can specify a TextureSet (Object Window/Miscellaneous/TextureSet) for each piece. Bethesda uses this a lot; to name a few examples, cloth banners, dirt cliffs, and roads all use TextureSets to reskin the same handful of 3D models.



Taking a brief look at a TextureSet in the Creation Kit, I see that they can specify multiple texture files -- diffuse, normal, and glow maps, for example. So I'm guessing that the SKSE TextureSet functions allow you to change, at run-time, what textures a TextureSet uses.

User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Wed May 11, 2016 10:56 pm

I think I follow. What do you mean by run-time? I'm playing around with it but this is the only way I could get it to compile and it doesn't make sense to me.



TextureSet Property MyTexturePath Auto

;stuff
MyTexturePath.SetNthTexturePath(1, MyTexturePath)

I want to point to the item itself, I tried a few things but no luck.



Edit: Could the int be pointing to a BSLightingShaderProperty number on the model itself? 1st string, 2nd string etc

User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm

Post » Wed May 11, 2016 11:42 am

Changing something "at run-time" means changing it in memory while the game is running, in contrast to changing it in the game's files. The term is often used when discussing something that can't normally be changed at run-time (like TextureSets, which can't be changed without SKSE).





TextureSets don't have any connection to 3D models: the models forms use them; they don't use the models. The integer has to be an index for textures in the TextureSet, but I'm not sure if the indices have a consistent meaning across all TextureSets. For example, if you open up the CowPainted TextureSet in the Creation Kit, you'll see that it has three textures; so if you wanted to work with that TextureSet, you should be able to change the diffuse map (colors), normal map (bumps), and subsurface map (flesh?) independently of each other.



Would you mind telling us what you're trying to do? Knowing that might make it easier to get you where you're going.

User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Wed May 11, 2016 7:22 pm

Thanks for clearing that up.


I'm trying to change the texture set based on light level.



Scriptname AceLightLevelScript extends ObjectReference

Actor Property PlayerRef Auto
Weapon Property LightGem Auto ;Item itself
TextureSet Property MyTexturePath Auto ;Random texture for testing purposes

Event OnEquipped(Actor akActor)

If PlayerRef.IsEquipped(LightGem)

PlayerRef.UnEquipItem(LightGem)

EndIf


While PlayerRef.GetEquippedWeapon(true) == LightGem

If PlayerRef.GetLightLevel() <=1

Debug.Notification("One with the shadows")

ElseIf PlayerRef.GetLightLevel() >1 && PlayerRef.GetLightLevel() <=3

Debug.Notification("Very Dark")

ElseIf PlayerRef.GetLightLevel() >3 && PlayerRef.GetLightLevel() <=5

Debug.Notification("Quite Dark")

ElseIf PlayerRef.GetLightLevel() >5 && PlayerRef.GetLightLevel() <=15

Debug.Notification("Somewhat Dark")
MyTexturePath.SetNthTexturePath(1, MyTexturePath) ;Initial test to see if it changes

ElseIf PlayerRef.GetLightLevel() >15

Debug.Notification("Not in the dark")

Endif

EndWhile

EndEvent
User avatar
Dan Wright
 
Posts: 3308
Joined: Mon Jul 16, 2007 8:40 am

Post » Wed May 11, 2016 1:11 pm

Ah, I see. Interesting.



Have you tried passing zero instead of one? These sorts of things tend to be zero-indexed, so you might be changing the 1st texture when what you really want is the 0th.



And for that matter (and I'm sorry if this is a dumb question), is that texture-set actually being used by a nearby form so you can see it? When you set a form's 3D model, you have http://www.creationkit.com/Model_Data if the model supports them.

User avatar
jesse villaneda
 
Posts: 3359
Joined: Wed Aug 08, 2007 1:37 pm

Post » Wed May 11, 2016 8:30 am

I tried 0 as well but I don't think it'll make a difference if I'm not pointing to an object.


I thought it would be more like:



Self.SetNthTexturePath(0, MyTexturePath)
MyTexturePath.SetNthTexturePath(0, Self)
LightGem.SetNthTexturePath(0, MyTexturePath)

I don't quite understand the last question. I'm just testing right now so I selected any random staff and any random texture set(I think a set of clothing). Don't texture sets just wrap around the mesh regardless of being meant for it or not?

User avatar
Rude_Bitch_420
 
Posts: 3429
Joined: Wed Aug 08, 2007 2:26 pm

Post » Wed May 11, 2016 9:33 am

I know it's weird, but the goal is to edit the TextureSet itself rather than any object it's applied to. You *may* still have to reload 3D on objects that are using the Set, so they show the changes.


I haven't played with TextureSets much except when landscaping, so there are some particulars I don't know. If you applied it to a staff and saw the texture on the staff change while in the CK, then yeah, the Set is being applied.
User avatar
Steve Fallon
 
Posts: 3503
Joined: Thu Aug 23, 2007 12:29 am

Post » Wed May 11, 2016 1:49 pm

Ah. I had a look through art and sound and there doesn't seem to be a textureset option. Whoops!


I see there's an effect though, so I might be able to use that as feedback.



Edit: The weapon has to be re-equipped for SetEnchantment to take visual effect. Damn.



Here's the current code snippet:



ElseIf PlayerRef.GetLightLevel() >5 && PlayerRef.GetLightLevel() <=15

Debug.Notification("Somewhat Dark")

if LightGem.GetEnchantment() != Ench1

LightGem.SetEnchantment(Ench1)
PlayerRef.UnEquipItem(LightGem)
PlayerRef.EquipItem(LightGem)

EndIf

ElseIf PlayerRef.GetLightLevel() >15

Debug.Notification("Not in the dark")
if LightGem.GetEnchantment() != Ench2

LightGem.SetEnchantment(Ench2)
PlayerRef.UnEquipItem(LightGem)
PlayerRef.EquipItem(LightGem)

EndIf

Further testing shows it's the visuals are no where to be found. I think enchantments added this way lose there visuals, because that's what's happening with me.


You should give your weapon charge before you test enchantments.. Anyway, still needs to be updated. Looking for a subtler approach than unequip/equip.

User avatar
Luna Lovegood
 
Posts: 3325
Joined: Thu Sep 14, 2006 6:45 pm

Post » Wed May 11, 2016 7:23 pm

Hm... Try creating a MagicEffect for each shader. Put all of them on your Enchantment, and then, in your Enchantment, put conditions on each so that they apply when you want.


Conditions in a MagicEffect are checked only once; if they fail, the effect is never applied. Conditions in a Spell (and theoretically in an Enchantment) are checked once per second; when they fail, an effect is temporarily disabled. So if you have five effects on a spell and each has mutually-exclusive conditions (again, within the spell), then your spell can do five different things (or use five different shaders) depending on those conditions. I'm assuming Enchantments work the same way.
User avatar
Honey Suckle
 
Posts: 3425
Joined: Wed Sep 27, 2006 4:22 pm

Post » Wed May 11, 2016 7:36 am

I would never have thought to try something without scripts. Great idea!


Is this what you mean?


http://s31.postimg.org/84zqrnu9n/Like_This.jpg


The other effect is checking for lightlevel >12


It doesn't change at all it seems, even when equipping while in the condition is correct.



Edit: Found this, do you think it could be used for this?


http://www.creationkit.com/Play_-_EffectShader

User avatar
Tom Flanagan
 
Posts: 3522
Joined: Sat Jul 21, 2007 1:51 am

Post » Thu May 12, 2016 12:05 am

The first screenshot is exactly what I mean.


I actually don't know if an enchanted weapon, specifically, can change its shader during gameplay. If it doesn't work, you'll want to take a good look at your conditions to see if they're broken or if this trick just won't work in this situation. For testing purposes, you could also try creating an ability spell that uses the same conditions to apply shaders to an actor, and then giving yourself that spell via console commands: if you change shaders but your weapon doesn't, then the problem likely isn't the conditions.


The second link is for manually turning EffectShaders on and off with a script. If you can get a reference to your desired object, it can work; but I'm not sure that equipped weapons count as physical objects, since they're technically still in the inventory. Besides, it's easier and more efficient to use the condition method in favor of scripts, if it works in testing.
User avatar
Stryke Force
 
Posts: 3393
Joined: Fri Oct 05, 2007 6:20 am

Post » Wed May 11, 2016 7:51 pm

Cheers for clearing that up. I think I'll be using a different method for the light measuring tool. I'll circle back to it if this new method doesn't work out.


If you're still interested in helping me, this thread has the info and this post is what I'm up to. You can get away with just reading the EDIT part of the post, the rest was discussion and failed ideas of mine.


http://www.gamesas.com/topic/1601098-widget-and-basic-ui-creation/?p=25137742

User avatar
Jade Muggeridge
 
Posts: 3439
Joined: Mon Nov 20, 2006 6:51 pm


Return to V - Skyrim