Jump to content

Recommended Posts

Posted

Hello once again folks,

 

I'm working on a script that is attempting to change an actors' voice and was confused about how to go about doing it.

 

I'm aware under CreationKit.com the Race Script controls many of the flags associated with various actors such as what voice they use, but those particular pages in the CK wiki don't have a lot of information (essentially the pages are pretty much blank), and I wasn't able to readily find much information elsewhere.

 

So given all that does anyone have any knowledge how to change voice type in papyrus?

 

As usual, thanks for any help you can provide.

Posted (edited)

Maybe the syntax is as follows:

VoiceType property myVoiceProperty auto
 
; if just changing it to a new voice right away..
akActor.GetRace().SetDefaultVoiceType(myVoiceProperty)
 
;double check if it\s changed
debug.trace("Actor Voice Type: " +akActor.GetRace().GetDefaultVoiceType())
 
; if comparing..
if akActor.GetRace().GetDefaultVoiceType != myVoiceProperty)
    akActor.GetRace().SetDefaultVoiceType(myVoiceProperty)
endif'

I'm thinking this was likely requested to be made available in the past, so there might be a mod that uses these.

Edited by Rasikko
Posted

Thanks I'll let you know if it works. This looks promising, as I am trying to change an actors'voice as part of a spell effect.

 

I won't know for sure until I'll get home from work in about 4 hours or so, but I'll give it the old college try.

 

Thanks for your insight regarding this issue.

Posted

Alright, so I got home from work and got to work so to speak on this issue and I have good tidings:

 

A couple things,

 

Defining a Voicetype Property and attempting to use "akActor.GetRace().SetDefaultVoiceType(VoiceType)" only compiles if you run a 0/1 bool in front of the property parameter, so it needs to look like akActor.GetRace().SetDefaultVoiceType(0, VoiceType) *For Male Actors* or akActor.GetRace().SetDefaultVoiceType(1, VoiceType) *For Female Actors*. That will compile, the issue then however in testing is it doesn't seem to really do anything. This was some cause for alarm and I grabbed a stout from my fridge and sat back down.

 

I switched it up and tried "akActor.GetActorBase().SetVoiceType(VoiceType), and it worked. Mind you this is for SKSE only, and will not work without SKSE.

 

So if you look to this code snippet:

If PlayerRef.GetActorBase().GetSex() == 0
	akActor.GetActorBase().SetVoiceType(MaleVoice)
EndIf
If PlayerRef.GetActorBase().GetSex() == 1
	akActor.GetActorBase().SetVoiceType(FemaleVoice)
EndIf

Assuming you define PlayerRef, MaleVoice, Female Voice and akActor for that matter, you can use the preceding to change the voice type of an actor by using its actorbase to whatever you want, mind you in my example I have a condition that gets the Player's gender, and then makes the akActor change their voice to the defined MaleVoice voicetype, or FemaleVoice depending on player gender.

 

There isn't exactly the most documentation for the usage of SetVoiceType or SetDefaultVoiceType for that matter as they are both SKSE functions, but this hopefully helps people interested understand it a bit more.

Posted (edited)

I didn't know there was a SetVoiceType..for the ActorBase Script. Honestly when I thought of voice types, I thought only about the ObjectReference Script and nothing else. Many SKSE functions are not documented though. It's one of those things where the ones have documentation if they were used and the person decided to fill in the info ha.

Edited by Rasikko
Posted
That's what I'm noticing about some of the SKSE functions. I'm still new to scripting for SKSE functions so I'm learning quite a bit, but there's a lot of them that appear to be able to add some useful functionality.
  • Recently Browsing   0 members

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