Jump to content

[LE] Changing actor's voice type via script?


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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