Jump to content

[dev] SKSE ChangeHeadPart / regenerating NPC appearance


Recommended Posts

Hello,

 

I'm developing SynthEBD, a patcher that randomizes NPC appearance in a way that builds upon Everybody's Different Redone SSE. EBD SSE has a feature to change NPC headparts which works by calling SKSE's ReplaceHeadPart() function. However, despite not being mentioned in the CK wiki, much like the Actorbase's SetNthHeadPart script, this causes a dark face bug when the player leaves and re-enters an NPC's cell, as I see in my testing. EBD SSE got around this by calling a script to update the NPCs face texture:

 

;applies proper tintmask from npc record	
Function FixFaceTexture(Actor akActor, ActorBase akActorBase) Global										
	int index = akActorBase.GetIndexOfHeadPartByType(1) ; 1 is Face type, 3 is Hair
	HeadPart facePart = akActorBase.GetNthHeadPart(index)		
	string modName = getModName(akActorBase)
	string formIDString = getFormIDString(akActorBase)
	TextureSet akActorTexSet = akActorBase.GetFaceTextureSet()
	if (akActorTexSet)
		akActorTexSet.SetNthTexturePath(6, "Actors\\Character\\FaceGenData\\FaceTint\\" + modName + "\\" + formIDString + ".dds")
		NetImmerse.SetNodeTextureSet(akActor, facePart.GetPartName(), akActorTexSet, false) ; GetPartName() only exists in SKSE >= 2.0.17; for older versions we need to use the somewhat buggy GetName()				
		;DebugOutput("Found face texture for: " + akActorBase.getName() + ", " + formIDRaw + ": " + akActorBase.GetFaceTextureSet().GetNthTexturePath(0) + ", " +akActorBase.GetFaceTextureSet().GetNthTexturePath(6))
	EndIf	
	
EndFunction

 

However, this fails for NPCs that have a custom face sculpt (such as Bijin and most modern NPC replacers) - they end up with the head shape defined in their plugin, rather than the intended one from their facegen nif.

 

I'm kind of at the limit of my technical knowledge - I figure if there's a solution someone here might know. The NPC looks correct when they are first loaded into the game, as shown in the YouTube video above. Is there any way to restore them to that original state, that I could perhaps call when the player changes location? Or am I completely SOL on this functionality?

 

Thanks for any help!

Link to comment
6 minutes ago, Piranha91 said:

I'm kind of at the limit of my technical knowledge - I figure if there's a solution someone here might know. The NPC looks correct when they are first loaded into the game, as shown in the YouTube video above. Is there any way to restore them to that original state, that I could perhaps call when the player changes location? Or am I completely SOL on this functionality?

 

If the NPC creators proide the tools (headparts) they used, then this should work fine.  But they often don't.  I don't know how you could get around this.  Maybe develop a mechanism that checks the facegen against what is in the esp?  Maybe something that just blacklists known issues?

Link to comment

Can you elaborate? In this case, Bijin's Hulda does provide all of the assets referenced in the .esp file (meshes and textures). However, looking at the facegen .nif, it looks like some of the NiTriShape\BSLightingShaderProperty\BSShaderTextureSet Textures are set inconsistently (e.g. some start with "actors", some with "textures\actors", and some with "data\textures\actors"). Is it the ones referenced in the plugin, or in the facegen .nif, that need to actually exist?

Link to comment
2 hours ago, Piranha91 said:

I'm kind of at the limit of my technical knowledge - I figure if there's a solution someone here might know. The NPC looks correct when they are first loaded into the game, as shown in the YouTube video above. Is there any way to restore them to that original state, that I could perhaps call when the player changes location? Or am I completely SOL on this functionality?

 

I'm not sure how much this helps you, but the process a lot of the NPC mod authors use involves sculpting the face in Racemenu and then exporting that mesh. As long as the names of the headparts match the name listed in the esp, it doesn't cause the dark face bug. The actual mesh doesn't matter, just the names of the parts, in both the esp and facegen mesh. 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use