Jump to content

Question: Playing sounds in scripts


Recommended Posts

When playing audio files from a script does one use the wav or xma file type?
Also, can you play fuz files directly from a script, without having to extract the sound component? For example, I am using the V111RadScanner01 in a script, and I would like the play certain sounds depending on a conditional test (i.e., does the player have radiation). For example, play 0002a07f_1.fuz if there is no contamination, or play 0002a080_1.fuz if there is contamination present.
0002a07f_1.fuz = No Contamination Detected. Please exit the Clean Room.
0002a080_1.fuz = Contamination Detected. Initiating Decontamination Sequence.

function fireTriggerEvent()
; Take action when target enters/leaves trigger
if (bTargetInTrigger == true)
; Activate Rad Scanner 01
Self.GetLinkedRef(LinkCustom01).PlayAnimation("PlayAnimation")
; Activate Rad Scanner 02
Self.GetLinkedRef(LinkCustom02).PlayAnimation("PlayAnimation")
; Check to see if the player is radiated or not
int RadsToHeal = (game.GetPlayer().GetValue(pRads) as int)
if (RadsToHeal > 0)
pContaminated.play(0002a080_1)
else
pNoContamination.play(0002a07f_1)
endif
else
endif
endFunction

Link to comment
Share on other sites

You can use both. In short, wav does not compress the sound and should in theory output better sound quality. xma compresses the sound which makes the file size smaller at the cost of sound quality.

There is no correct answer, I guess. Every sound has it's own thing.

Usually xma is used, but if the sound quality gets too bad you may go with wav etc.

 

As far as I know, only SoundDescriptor object(s) can be used from vanilla papyrus scripts.

 

You could extract the sound, convert it to xma/wav and set up a sound descriptor.

I think the conditional can be set up in the descriptor too, so you have one descriptor pointing to two sound files configured with condition in the descriptor and let the descriptor do the if/flow/control, but as long as there are only two sounds I think it is nice as it is.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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