Dahveed Posted January 27, 2015 Share Posted January 27, 2015 Hello. I am messing around in the Companions' mead hall and trying to make the place a bit more lively. To do so I want to add a bard which would basically alternate between all the different available songs and instruments 24/7 without ever really stopping. I can already put a "normal" bard there that would take requests, but what I really want it just a bard who would stand in the same spot, play random music, and not interact with the player. Likewise I would not want other NPCs to react (i.e. applaud) after each song. they would continue as if the bard weren't even there. It would just serve to add some more "background noise" to Jorvasskr to make it seem more busy and lively. Would anyone know how to go about this? Thanks in advance. Link to comment Share on other sites More sharing options...
ArronDominion Posted January 30, 2015 Share Posted January 30, 2015 Sounds like you just want a NPC playing an idle animation that loops, and sound to come from them. You will want to attach a script to your NPC. You will want to have properties for all the SoundMarkers representing the songs you want them to play. You will want properties to keep track of the SoundMarkerState if there is more than one song (I.E. a SoundDescription that the SoundMarker is pointing to is composed of 4 sounds, you want logic for all 4). I recommend either creating an array of SoundMarkers or a FormList so you can keep track of what SoundMarkers have been played (if you want the songs to be picked at random, otherwise ignore this part). You might want to use OnInit() to call your song playing function. Within your play function you want to use RegisterForSingleUpdate() with the time being the length (in seconds) of the song. You want an Int property to keep track of the song choice you want next for your function logic. In your OnUpdate() you want to call your play function again with the Int property containing your song choice. Within the play function, if you reach the end of the list, and the final sound marker has been played once, you will want to reset your song play property to the first choice and reset the marker states back to their initial values. Hope this helps. Link to comment Share on other sites More sharing options...
Dahveed Posted February 1, 2015 Author Share Posted February 1, 2015 Thanks Arron I suppose, but I have no idea what the hell you are talking about, lol. I have no knowledge of scripting at all, unfortunately. I thought it would be much easier than that. Maybe one day I'll look some of this stuff up but for now it's not worth the effort. Thanks for the response, cheers. Link to comment Share on other sites More sharing options...
ArronDominion Posted February 2, 2015 Share Posted February 2, 2015 Here is a more concrete example, based on some of the functionality I created for MHARPHIN. This particular example is designed to be attached to your custom NPC, and only accounts for one sound marker with 6 sounds in the sound descriptor and does not account for playing an animation: ScriptName DahveedNPCBardTestScript Extends Actor ;Our current sound ID - is set to 0 and defaults to 0. Hopefully ID 0 is never called. Int Property CurrentSoundPlayingID Auto ;Our first sound marker Sound Property Sound1 Auto ;The state of the marker, can have up to 6 states Int Property SoundMarker1State Auto ;Global that holds CurrentSoundPlayingID so can check for it GlobalVariable Property GobalMusicControl Auto ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Inputs: Choice to tell the sound to play (allows for moddability), and NPC for the speaker ; ;This function is designed to play a sound from a NPC upon Function call ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function PlayNPCSound(Int Choice, Actor NPC) ;Choice logic ;1 = Sound1 if (Choice == 1) CurrentSoundPlayingID = Sound1.Play(NPC) GobalMusicControl.SetValue(CurrentSoundPlayingID) ;So the Sound ID resets if the sound finishes before the next call - 325 since this is the complete time for both ;However due to how Skyrim calls the Sound Play() function, we will have to keep track of the current song being played if SoundMarker1State == 0 ;The length of the first piece RegisterForSingleUpdate(173.0) ;Prepare the logic to call the next song properly SoundMarker1State = 1 ElseIf SoundMarker1State == 1 ;The length of the last piece RegisterForSingleUpdate(183.0) ;Prepare the logic to go back to the beginning of the song queue, aka the first song SoundMarker1State = 2 ElseIf SoundMarker1State == 2 ;The length of the last piece RegisterForSingleUpdate(189.0) ;Prepare the logic to go back to the beginning of the song queue, aka the first song SoundMarker1State = 3 ElseIf SoundMarker1State == 3 ;The length of the last piece RegisterForSingleUpdate(183.0) ;Prepare the logic to go back to the beginning of the song queue, aka the first song SoundMarker1State = 4 ElseIf SoundMarker1State == 4 ;The length of the last piece RegisterForSingleUpdate(189.0) ;Prepare the logic to go back to the beginning of the song queue, aka the first song SoundMarker1State = 5 Else ;The length of the last piece RegisterForSingleUpdate(175.0) ;Prepare the logic to go back to the beginning of the song queue, aka the first song SoundMarker1State = 0 EndIf EndIf EndFunction ;Plays at the very beginning Event OnInit() PlayNPCSound(1,self) EndEvent Event OnUpdate() PlayNPCSound(1,self) EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts