Jump to content

Adding voice types to voice formlists through scripts


wtfmanreally

Recommended Posts

Hey there.

 

First than nothing, I actually did it already, and it does work with no apparent trouble. I'm doing this to prevent modifying the formlists in the load order, effectively avoiding conflicts between plugins that modify their contents.

 

This is how I'm doing it:

 

First, I create a quest just how it gets created when you use RacialCompatibility (I just disable "run once").

 

Then, I create a new script, add my properties and edit, and this is the script:

 

Scriptname AddBerserkVoicesScript extends Quest  

VoiceType Property MaleGuts  Auto  

VoiceType Property FemaleCasca  Auto  

VoiceType Property FemaleSchierke  Auto  

FormList Property VoicePowerVoicesListNoDraugr  Auto  

FormList Property VoicePowerVoicesListwithTsun  Auto  

FormList Property VoicePowerVoicesList  Auto  

FormList Property VoicesFollowerRough  Auto  

FormList Property VoicesCommonCombatant  Auto  

FormList Property VoicesPlayer  Auto  

FormList Property VoicesCommonAdult  Auto  

FormList Property DefaultNPCVoiceTypes  Auto  

FormList Property VoicesNPCs  Auto  

FormList Property VoicesFollowerNeutral  Auto  

function addvoicetypesberserk()
VoicePowerVoicesListNoDraugr.AddForm(MaleGuts)
VoicePowerVoicesListNoDraugr.AddForm(FemaleCasca)
VoicePowerVoicesListNoDraugr.AddForm(FemaleSchierke)
VoicePowerVoicesListWithTsun.AddForm(MaleGuts)
VoicePowerVoicesListWithTsun.AddForm(FemaleCasca)
VoicePowerVoicesList.AddForm(MaleGuts)
VoicePowerVoicesList.AddForm(FemaleCasca)
VoicePowerVoicesList.AddForm(FemaleSchierke)
VoicesFollowerRough.AddForm(MaleGuts)
VoicesFollowerRough.AddForm(FemaleCasca)
VoicesFollowerNeutral.AddForm(FemaleSchierke)
VoicesCommonCombatant.AddForm(MaleGuts)
VoicesCommonCombatant.AddForm(FemaleCasca)
VoicesCommonCombatant.AddForm(FemaleSchierke)
VoicesPlayer.AddForm(MaleGuts)
VoicesPlayer.AddForm(FemaleCasca)
VoicesPlayer.AddForm(FemaleSchierke)
VoicesCommonAdult.AddForm(MaleGuts)
VoicesCommonAdult.AddForm(FemaleCasca)
VoicesCommonAdult.AddForm(FemaleSchierke)
DefaultNPCVoiceTypes.AddForm(MaleGuts)
DefaultNPCVoiceTypes.AddForm(FemaleCasca)
DefaultNPCVoiceTypes.AddForm(FemaleSchierke)
VoicesNPCs.AddForm(MaleGuts)
VoicesNPCs.AddForm(FemaleCasca)
VoicesNPCs.AddForm(FemaleSchierke)
endfunction

Event OnInit()
addvoicetypesberserk()
EndEvent

 

 

I only know it is indeed adding them dynamically in-game, because I activated the plugin using this script with a similar plugin containing a script to add the female khajiit voice to the followervoicesneutral formlist, and they work nicely together. What I don't know is -how- it's doing it.

 

These are my questions:

 

1- Will this happen only once?

2- Will this happen every time the savegame gets loaded?

3- Do the voice types get "unloaded" from the formlists ingame whenever you exit the game?

4- Do the voice types disappear whenever you deactivate the plugin?

5- Will it keep on adding the voice type forms even if they're already there?

6- Should I make it check for the voice types being in these formlists before adding them?

6.a- If so, how?

 

Or rather, should I make it unload the voice types from the formlists on exit, or with some function attached to some NPC with dialog?

 

Thanks.

Edited by wtfmanreally
Link to comment
Share on other sites

Well, thanks to Irfeir's help at the Skyrim CK public chat in Steam I figured it out. The solution to the quest adding it every time the save is loaded was to nest every formlist.addform(form) inside an if !formlist.hasform(form), to check if the formlist didn't contain the form, if it didn't, add it, if it did, do nothing.

 

Then to uninstall it, to prevent the forms from staying inside the formlist after the plugin/master is disabled, I created a spell to stop the quest, check if the forms are there with formlist.hasform(form), remove every added form from every formlist with formlist.removeaddedform(form), and show a dialog saying it's safe to remove now.

 

I hope this helps people adding stuff to formlists dinamically in the future. If it works with voice types, it should work with mostly everything else. Good luck.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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