skinnytecboy Posted December 5, 2014 Author Share Posted December 5, 2014 Hi chaps, firstly, thanks so much for your help and wisdom with this. I really do appreciate it and I will of course credit all help provided. Okay, so I've been doing a little testing with the above methods and also the scene method, and although they work (without sound marker in the cell) when the script or scene is called a 2nd time... I get CTD. Just to expand a little more, my sound descriptor contains several sounds which I hoped would play randomly.. The problem with the script method is that I need to find a way of stopping any music already playing (sound descriptor) if the player opens up the same dialogue again that fires the script. Is there a way to do this? I guess I could create lots of individual sound markers and disable them using aliases, but I'm planning upon having quite a fair amount of random music. He is a walking jukebox after all. Link to comment Share on other sites More sharing options...
DDProductions83 Posted December 5, 2014 Share Posted December 5, 2014 Actually you could have a cell with all the sound markers disabled, and upon asking him to play something a generic script fires to disable all markers except the one you wanted to play and instead move the new one to his location and onupdate 1 second move it to him, then unregister it for update with the generic script, the problem with that would be zoning to a new cell but realistically you could create a script to fix that.. it is just really beyond you atm if you had trouble with this one, not to sound bad about it lol, you could also just make them random idles in scenesUse a scene to force a dialogue and he plays the music via the dialogue but then when you spoke to him it would turn it off IDK if anyone has a easier idea on this one Link to comment Share on other sites More sharing options...
ArronDominion Posted December 5, 2014 Share Posted December 5, 2014 (edited) Sound.Play() has a return value of type Integer. This integer is the unique ID of the current playback, meaning you shouldn't require physical copies of the marker. Below is an example of how you could integrate this (with commented assumptions on quest structure, and one tiny potential bug concerning the global, which probably could be corrected by registering for a single update with the seconds of the current sounds you are playing calling an update event to reset the global, but I haven't tested it): The Quest Script: Scriptname SoundScriptExample extends Quest ;These are examples of properties I imagine for this situation ;The global is used to keep track and see if you are currently playing one of your sounds ;It will never reset back to 0 in its current form, so you might have to rethink that part Int Property CurrentPlayingSoundID Auto Hidden Global Property YouAreCurrentlyPlayingASound Auto Sound Property YourSoundMarkerName Auto Sound Property YourSecondSoundMarkerSoundName Auto ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;The purpose of this function is to cease the current playback and play the sound again ;In this example, I am utilizing two different markers to show choice logic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function CeaseCurrentPlaybackAndPlaySoundAgain(Actor SpeakingNPC, Int SoundChoice) ;Release your current Sound playback StopInstance(CurrentPlayingSoundID) ;Call your normal sound function PlaySoundFromChoice(SpeakingNPC, SoundChoice) EndFunction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;The purpose of this function is to play a sound based on an input, storing the play id ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function PlaySoundFromChoice(Actor SpeakingNPC, Int SoundChoice) ;Choice logic ;0 = YourSoundMarkerName ;1 = YourSecondSoundMarkerSoundName ;Change your CurrentPlayingSoundID ;Choice Logic ;0 = YourSoundMarkerName ;1 = YourSecondSoundMarkerSoundName If Choice == 0 CurrentPlayingSoundID = YourSoundMarkerName.Play(SpeakingNPC) Else ;Choice 1 CurrentPlayingSoundID = YourSecondSoundMarkerSoundName.Play(SpeakingNPC) EndIf YouAreCurrentlyPlayingASound.SetValue(1) EndFunction ;Garbage function for kmy initialization Function Garbage() ;Indeed EndFunction The Dialogue Fragments: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;This portion is for your first Dialogue Fragment ;I decided to have a global keep track to see if a sound is currently playing so I could use that a dialogue condition ;There is probably a more elegant way to tackle this. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (GetOwningQuest as SoundScriptExample).PlaySoundFromChoice(akSpeaker, 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;This portion will be used within the version of the Dialogue with the global check ;Again, there is probably a more elegant and efficient way to integrate this ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (GetOwningQuest as SoundScriptExample).CeaseCurrentPlaybackAndPlaySoundAgain(akSpeaker, 0) kmyQuest initialization: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;This portion will be used within your quest stage in the kmy block ;Set the kmyQuest to SoundScriptExample, or whatever your script is named within the Quest ;It might give you an initial error, I know it does in my CK, just close the quest and reopen to see if it properly compiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; kmyquest.Garbage() Edited December 5, 2014 by Arron Dominion Link to comment Share on other sites More sharing options...
ArronDominion Posted December 11, 2014 Share Posted December 11, 2014 As an update for the CTD issue if anyone is curious or runs into Sound Descriptor related CTD in the future, there is a limit on how big a sound file can be. Roughly 3 min 10 sec for the length. After talking to one of my programming friends, the thought is that this is most likely due to the console's memory limit, and the handling for sound on the console being carried over to the PC version. Link to comment Share on other sites More sharing options...
skinnytecboy Posted December 11, 2014 Author Share Posted December 11, 2014 Ah.. I see. Think I'll reduce all my tracks to 3min max. Thanks for the tip Link to comment Share on other sites More sharing options...
DDProductions83 Posted December 11, 2014 Share Posted December 11, 2014 There would be a way around that with music files and you could force add music to zone tracks, but that would go all to hell if the player had their music volume low and/or they zoned rofl Link to comment Share on other sites More sharing options...
skinnytecboy Posted December 23, 2014 Author Share Posted December 23, 2014 Sorry for delayed response. All sound issues now sorted thanks to Arron's script help :) Hoping to release ASAP http://m.youtube.com/#/watch?v=SoiWJGzzq4Y Have a great festive Yule, yol.;) Link to comment Share on other sites More sharing options...
Recommended Posts