Jump to content

Questions about voice objects


The Man in Black

Recommended Posts

Posted

I have an idea for a mod that will essentially give each female character two voice sets, then swap them depending on whether they're the victim in the animation (along with custom voice packs for SexLab Extra Voices for the purpose). To do this, I need to create an array of sslBaseVoice objects containing all currently registered and enabled voices to work with. How would I go about doing this? I don't see anything in the SexLabFramework script, and there's not much documentation for the voice-related scripts.Where are the voices stored and how can I access the master list?

Posted
sslBaseVoice voice = ...
sslBaseVoice voiceVictim = ...

Event SLAnimStarting(int tid, bool HasPlayer)
    sslThreadController slScene = SexLab.GetController(tid)

    if (slScene == None)
        return
    endif

    Actor[] actorList = slScene.Positions
    Actor a
    
    int i = 0
    
    while (i < actorList.Length)
        a = actorList[i]

        if (a != None && a.GetLeveledActorBase().GetSex() == 1)
            if (slScene.IsVictim(a))
                SexLab.SaveVoice(a, voiceVictim)
            else
                SexLab.SaveVoice(a, voice)
            endif
        endif

        i += 1
    endwhile
EndEvent

 

Make sure to register the event on OnInit and OnPlayerLoadGame.

 

RegisterForModEvent("HookAnimationStarting", "SLAnimStarting")

 

If you need to dynamically get the voices:

 

SexLab.GetVoiceByName("My Voice Name")

 

or

 

SexLab.VoiceSlots.GetbyRegistrar("My Voice Registrar")

 

or

 

SexLab.GetVoiceBySlot(registeredVoiceSlot)

 

This works even for voice sets that are disabled. They just need to be registered into SexLab.

 

Please look at my mod's source code for a functioning PoC. 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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