Jump to content

[SE] Best Method to Detect Actor Mood Changes?


Recommended Posts

Hi,

I want my follower to have distinct head normal maps depending on whether they are smiling, surprised, etc. I see there are papyrus functions to retrieve an actor's mood and update their head textures to accomplish this. There doesn't seem to be an event to listen for expression changes. I'm hoping to avoid having a script perpetually running and checking.

Is there an elegant solution I'm overlooking? Otherwise, is there a convention for time intervals a mod should recursively call RegisterForSingleUpdate() to avoid causing lag?

Thanks in advance.

Link to comment
Share on other sites

Strangely enough there is an actor value for mood you could experiment with. Attach an ability to the actor/s or magic effect/s which can run a script once a condition applies

How well this will work, is not something you would be likely to get a concrete answer for. Even if someone claims something is impossible, they might be wrong. Just research these a bit and maybe try them out and see what you can make work

Some examples of conditions

GetDialogueEmotion
GetDialogueEmotionValue
IsPleasant
GetActorValue: Energy

Etc

image.png

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

MFG is very useful! Here's what I came up with to change textures depending on actor expression.
This script can be added directly to the actor in Creation Kit. Implements OnLoad() and OnUnload() events to only run when the player is nearby. The textures go in TextureSet properties. Every 5 seconds it checks the expression and a phoneme. Currently alternates between smiling and not. Requires MFG Fix and PO3 Papyrus Extension.

Spoiler
Scriptname MOD_ActorScript extends Actor  
{Controls face textures.}

TextureSet Property FaceNeutral  Auto  
{ Contains normal map for neutral face }

TextureSet Property FaceSmiling  Auto  
{ Contains normal map for smiling  face }

Int Property UpdateInterval = 5 Auto  
{ Frequency (in seconds) to check for expression changes }

Bool Property MOD_Loaded = False Auto  
Bool Property IsNeutral = True Auto  

Event OnLoad()
	if !MOD_Loaded
		RegisterForSingleUpdate(UpdateInterval)
	endif
	MOD_Loaded = true
EndEvent

Event OnUnload()
	UnregisterForUpdate()
	MOD_Loaded = false
EndEvent

Function MOD_SetTexture(TextureSet FaceTexture) ; Set new texture
	PO3_SKSEFunctions.ReplaceFaceTextureSet(self,  FaceTexture,  FaceTexture, 1)
EndFunction

Event OnUpdate()
	Int NewExpressionID = MfgConsoleFunc.GetExpressionID(self)
;	Debug.notification("E: " + NewExpressionID + " P5: " + MfgConsoleFunc.GetPhoneme(self, 5))
	if (NewExpressionID == 2) || (NewExpressionID  == 10) || (MfgConsoleFunc.GetPhoneme(self, 5) >= 50)
		if IsNeutral
			MOD_SetTexture(FaceSmiling)
			IsNeutral = false
		endif
	elseif !IsNeutral
		MOD_SetTexture(FaceNeutral)
		IsNeutral = true
	endif
	if MOD_Loaded
		RegisterForSingleUpdate(UpdateInterval)
	endIf
EndEvent

 

 

Edited by NewUser221341
Clarity and better answer.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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