Jump to content

Quest Script Wont Play Sounds


felixk4

Recommended Posts

Well, I've been trying to figure out how to play sounds through a Quest Script but so far it hasn't worked. I've tried almost every sound available in the CK and nothing works.

 

Scriptname MyScript:MyScript extends Quest


Sound Property MySound Auto


Int Property SFX auto


Event OnInit()
MyFunction()
EndEvent


Function MyFunction()
RegisterForAnimationEvent(Game.GetPlayer(), "weaponFire")
EndFunction


Event OnAnimationEvent(ObjectReference akSource, string asEventName)
If (asEventName == "weaponFire")




Actor soundSource = Game.GetPlayer()
SFX = MySound.play(soundSource)
Sound.SetInstanceVolume(SFX , 1)


Debug.Notification("Beep")


EndIf
EndEvent
Edited by felixk4
Link to comment
Share on other sites

Oh, right. Hmmmm, now I remember trying to do something similiar and I had problems getting the sound play too. I ended up doing magic effect that has sound effect on hit I think. You could do magic effect with sound, put that magic effect to spell, then that spell to perk, that has Apply Combat Hit Spell and your spell, maybe? Then you can use conditions to controll when it's supposed to play.

 

I needed a sound to play when player is hit by certain enemy, so I gave my enemy combat hit spell that plays sound on contact. Of course, It won't play if you don't hit enemies, so maybe it's not good for you.

 

Theres propably some trick to that Play function, but I don't know what that is.

Edited by vkz89q
Link to comment
Share on other sites

Try this.

 

 

Scriptname MyScript:MyScript extends Quest

Sound Property MySound Auto
Actor Property PlayerRef Auto

Event OnQuestInit()
    RegisterForAnimationEvent(PlayerRef, "weaponFire")
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
    If asEventName == "weaponFire" && akSource == PlayerRef
        MySound.play(PlayerRef)
        Debug.Notification("Beep")
        RegisterForAnimationEvent(PlayerRef, "weaponFire")    ; need to re-register for further weaponfire events
    EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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