felixk4 Posted March 14, 2017 Share Posted March 14, 2017 (edited) 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 March 14, 2017 by felixk4 Link to comment Share on other sites More sharing options...
vkz89q Posted March 14, 2017 Share Posted March 14, 2017 You need to register for animation event. If that is your whole script, you didn't register for it. https://www.creationkit.com/fallout4/index.php?title=OnAnimationEvent_-_ScriptObject Link to comment Share on other sites More sharing options...
felixk4 Posted March 14, 2017 Author Share Posted March 14, 2017 You need to register for animation event. If that is your whole script, you didn't register for it. https://www.creationkit.com/fallout4/index.php?title=OnAnimationEvent_-_ScriptObject I did register the event and I always see the notification displays, but the sound never plays. :confused: Link to comment Share on other sites More sharing options...
vkz89q Posted March 14, 2017 Share Posted March 14, 2017 (edited) 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 March 14, 2017 by vkz89q Link to comment Share on other sites More sharing options...
felixk4 Posted March 14, 2017 Author Share Posted March 14, 2017 Yeah, I know about adding sounds with magic effects but I'm trying to use a Quest to manage something. :ermm: Link to comment Share on other sites More sharing options...
steve40 Posted March 18, 2017 Share Posted March 18, 2017 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 More sharing options...
Recommended Posts