Deleted31005User Posted December 10, 2014 Share Posted December 10, 2014 So I always wanted to add a singing bard that goes to different locations around my town and the Hearthfire bard script seems perfect for that, after changing a few things on it it works all well as intended except for one thing:-Normally he shouldn't start playing during night hours when hes sleeping, but it doesn't work and he still gets up and starts to play/sing in the middle of the night.Can someone with some scripting experience please help me, this is how the script looks so far: Quote Scriptname Tel_Nalta_Script_HouseBard extends ObjectReferenceString Property sInstrument = "Lute" Auto {current instrument to play instrumental musicdefaults to Lute}int Property iPlayOnLoadPercent = 40 Auto{ percent chance that bard will be playing when you enter the house default = 50}int Property iPlayOnLoadStartHour = 7 Auto{ earliest time to start playing onload }int Property iPlayOnLoadEndHour = 20 Auto{ latest time to start playing onload }GlobalVariable Property GameHour AutoBardSongsScript Property BardSongs Auto event OnCellAttach() if !IsEnabled() ; move back to my editor location and enable MoveToMyEditorLocation() Enable() else ; if I'm in the house, and between the right hours, play music if GameHour.GetValueInt() >= iPlayOnLoadStartHour && GameHour.GetValueInt() <= iPlayOnLoadEndHour && GetEditorLocation() == GetCurrentLocation() debug.trace(self + " OnLoad: play music") ; instrumental or sung? if Utility.RandomInt(1, 2) == 1 debug.trace(self + " OnLoad: instrumental") BardSongs.PlaySong(self, sInstrument, true ) else debug.trace(self + " OnLoad: vocal") BardSongs.PlaySongRequest(self, "Any", true, BardSongs.GetRandomSong(self)) endif else if GetEditorLocation() == GetCurrentLocation() BardSongs.StopAllSongs() endif endif endifendEvent Link to comment Share on other sites More sharing options...
Deleted31005User Posted December 18, 2014 Author Share Posted December 18, 2014 Nobody with some scripting skills willing to help me with my bard? Link to comment Share on other sites More sharing options...
Terra Nova Posted December 18, 2014 Share Posted December 18, 2014 (edited) You need another check. You do not want the NPC to play if they are sleeping right? A made a few modifications to your script. You will need to change the script your script is extending from ObjectReference, to Actor in order for this to work.Scriptname Tel_Nalta_Script_HouseBard extends Actor String Property sInstrument = "Lute" Auto {current instrument to play instrumental music defaults to Lute} int Property iPlayOnLoadPercent = 40 Auto { percent chance that bard will be playing when you enter the house default = 50 } int Property iPlayOnLoadStartHour = 7 Auto { earliest time to start playing onload } int Property iPlayOnLoadEndHour = 20 Auto { latest time to start playing onload } GlobalVariable Property GameHour Auto BardSongsScript Property BardSongs Auto event OnCellAttach() Int GetCurrentHour = GameHour.GetValueInt() if !IsEnabled() ; move back to my editor location and enable MoveToMyEditorLocation() Enable() else ;Check if Im sleeping, and if I am, dont do anything. if GetSleepState() == 3 return else ; if Im in the house, and between the right hours, play music if GetCurrentHour >= iPlayOnLoadStartHour && GetCurrentHour <= iPlayOnLoadEndHour && GetEditorLocation() == GetCurrentLocation() debug.trace(self + " OnLoad: play music") ; instrumental or sung? if Utility.RandomInt(1, 2) == 1 debug.trace(self + " OnLoad: instrumental") BardSongs.PlaySong(self, sInstrument, true ) else debug.trace(self + " OnLoad: vocal") BardSongs.PlaySongRequest(self, "Any", true, BardSongs.GetRandomSong(self)) endif else if GetEditorLocation() == GetCurrentLocation() BardSongs.StopAllSongs() endif endif endif endif endevent Edited December 18, 2014 by Terra Nova Link to comment Share on other sites More sharing options...
Deleted31005User Posted December 18, 2014 Author Share Posted December 18, 2014 He still gets up and start playing :(Tested it on a clean save game. Link to comment Share on other sites More sharing options...
Recommended Posts