SetVoiceType - ActorBase

From the CreationKit Wiki
Jump to navigation Jump to search


Changes the voice of myActor to newvoice.

This change alone is not persistent when saving the game. You must store the new voicetype in a formlist and recover it from there with onplayerloadgame when loading the save game. ( Remember that this works only on the second save game load after introducing a new player alias ! )


Voicetype property newvoice auto ;;;;;;; ( fill in script properties tab )

Formlist property voicelist auto ;;;;;; ( dito ) must have been created empty in CK

                                ;;;;;; every actor must have its own list

Actor property myactor auto ;;;;; ( filled elsewhere )



Function somefunc()

      Myactor.getactorbase().setvoicetype(newvoice)
      Voicelist.revert()  ;;;; must be empty for next statement


      Voicelist.addform(newvoice) ;;;; remember voicetype for this actor in entry 0

Endfunction


In Script on player alias:

Event onplayerloadgame()

    Voicetype vt = voicelist.getat(0) as voicetype   ;;; only one entry !
    Myactor.getactorbase().setvoicetype(vt)  ;;; remembered for new save load

Endevent