Jump to content

Set texture and tint with scripts


Recommended Posts

Hi, I'm still learning papyrus and such and I'm wondering if anyone happens to know how to get and set actor texture and tint color with a script. I'm basically making a facechanger mod and I got morphs and race stuff working (at least so far) but the thing that still seems to elude me is the coloring and textures of actors. Ie skin color doesn't update correctly, custom hair (like from Apachii's) is a weird purple and super basic planes (which I assume the textures would fix), hair overlapping, and some other oddities with stuff. I attached a picture to show what's happening - trying to apply the NPC's stuff (on the right) to the player on the left - weird hair mesh, old ponytail still exists underneath, and wrong skin tone. Any help with this would be greatly appreciated!

Link to comment
Share on other sites

You can do a lot of things with SKSE calls but skin tone is not one of them.

 

I have a mod that alters NPCs in a somewhat similar way and you can look at my source code to see if it helps you at all in general (the main script is called ORNScript.psc) : Skyrim Temp Agency. Changing hairstyle ought to work (it does for me), provided you do the update call afterwards.

 

Basically, though, I dodge your issue by leaving skin tone as the racial default because otherwise the body and head don't match.

Link to comment
Share on other sites

  • 1 year later...

Necro'ing an old thread. I found a way to *kind of* do it but still need to figure the rest out and was hoping someone could jump in with some extra insight for this procedure.

 

So, the idea is gleaned from Player Succubus Quest mod (Lover's Lab mod.) There's actually two parts to it - using NiOverride (RaceMenu) for the body color, and an skse function for the facetint.

 

The NiOverride script is like this:

bool Property PlayerSex Auto hidden
Actor Property PlayerRef Auto
Int Property ColorShiftValue = -16775751 Auto Hidden

Function SomeFunction()
PlayerSex = PlayerRef.GetActorBase().GetSex() as bool

NiOverride.AddSkinOverrideInt(PlayerRef as ObjectReference,PlayerSex,false,0x00000004,7,-1,ColorShiftValue,true)
EndFunction

Properties explanation: 1: Target to recolor. Accepts actor and is good practice to cast as objectReference 2: Player in-game sex setting (male femme) 3: is first person, keep it false 4: slotmask. You can find a list of slotmasks on creation kit wiki. 5: Key value, which there's a description of what each key value does at the top of NiOverride script. 6. index. I think -1 is always a good value here. 7: Colorshiftvalue = the color to shift to, 8: persist setting (whether to write the color change to savefile or not)

 

The above will turn the player's body (not hands, feet , or face) a dark blue.

 

Now, for the face color, an SKSE function works with some of the same input

Game.SetTintMaskColor(ColorShiftValue)
Game.QueueNiNodeUpdate() 

This will set the player's face to the color index in int, but must be called before the bodyshift changes. Else when QueueNiNodeUpdate() hits, it will clear out the body color change.

 

Dilemma: Mod Config Color Setting

 

I'm trying to use the Mod Config menu's color picker option to pick a color. The problem is that whatever value MCM feeds into the int variable doesn't seem to work with RaceMenu's color functions for some reason. Initial color as set originally works perfect (see above value.) When I change it via mod config menu colorpicker, the whole thing breaks. Some insight if anyone has it would be appreciated.

 

But I hope the above info was also helpful to someone.

 

Edit: Forget all of that above. What will work above is changing everything else except the face. For a simple uniform recolor of the entire body, there's a better way.

Actor Property PlayerRef Auto
Int Property ColorShift Auto
Int Property AlphaVal = 255 Auto hidden

int Function GiveMeColor()
int val = ColorShift + AlphaVal * 16777216
return val
EndFunction

Game.SetTintMaskColor(GiveMeColor(),6,0)


This will transform your character to a vivid shade of whatever color int you feed into colorShift which can be gotten via either MCM code, plain int value, or by other means. It'd be a good idea to save your original tintmask with

Int Property OriginalTint Auto hidden

OriginalTint = Game.GetTintMaskColor(6,0)

 

Edited by SilverDragon437
Link to comment
Share on other sites

  • Recently Browsing   0 members

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