Issues with musictypes

Post » Tue Dec 24, 2013 12:06 pm

I have a piece of script that first does

'myMusicType.add()' ; the music type here is MUSCombat

then it follows it with a bunch of fights that are scripted, and lastly does:

'myMusicType.remove()' ; same music type variable

Problem is that occasionally, the combat music never stops playing. I can't figure out what's going on. Any help would be appreciated!

User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Tue Dec 24, 2013 10:12 am

Attaching my script here:

Spoiler
Scriptname TMSpawnManageScript extends ObjectReference  quest property myquest Auto  int property mystage Auto  objectReference[] property fights Auto  MusicType Property music  Auto  ObjectReference Property Entrance  Auto  ObjectReference Property Exit  Auto  float property sneakScale Autobool active  float maxDfloat dNormalfloat dSmallfloat dLargefloat dVLargeEvent OnActivate(ObjectReference akActionRef)	if(!active)		active = true				start()				int i = 0		while(i < fights.length)			fights[i].activate(self)			i += 1		endWhile				self.registerforsingleupdate(0.5)	endIfendEventevent onUpdate()	bool notDone	int i = 0	while(i < fights.length)		if(!fights[i].isdisabled())			notDone = true		endIf	i += 1	endWhile	if(!notDone)		end()	else		self.registerforsingleupdate(0.5)	endIfendEventfunction start()		;close the entrance		if(entrance != none)			entrance.activate(self)		endIf		;start the music		if(music != none)			music.add()		endIf		changeToCombatSettings()endFunctionfunction end()		active = false		changeToNormalSettings()				;stop the music		if(music != none)			music.remove()		endIf				;Update any associated quest		if(myQuest != none)			myQuest.setstage(myStage)		endIf				;open the entrance		if(entrance != none)			entrance.activate(self)		endIf				;open the exit		if(exit != none)			exit.activate(self)		endIf				;disable this object		self.disablenowait(false)		endFunctionfunction onLoad()	if(active)		changetoCombatSettings()	endIfendFunctionfunction changeToCombatSettings()    DSmall = Game.getGameSettingFloat("fSneakDetectionSizeSmall")    DLarge = Game.getGameSettingFloat("fSneakDetectionSizeLarge")    DVLarge = Game.getGameSettingFloat("fSneakDetectionSizeVeryLarge")    DNormal = Game.GetGameSettingFloat("fSneakDetectionSizeNormal")    MaxD = Game.getGameSettingFloat("fSneakMaxdistance")        Game.setGameSettingFloat("fSneakDetectionSizeNormal" , 1 + sneakScale)    Game.setGameSettingFloat("fSneakDetectionSizeSmall" , 0.5 + sneakScale)    Game.setGameSettingFloat("fSneakDetectionSizeLarge" , 1.5 + sneakScale)    Game.setGameSettingFloat("fSneakDetectionSizeVeryLarge" , 2 + sneakScale)    Game.setGameSettingFloat("fSneakMaxdistance" , 40000.0)endFunctionfunction changeToNormalSettings()	if(DNormal != 1 + sneakScale)	    Game.setGameSettingFloat("fSneakDetectionSizeNormal" , DNormal)	else		Game.setGameSettingFloat("fSneakDetectionSizeNormal" , 1)	endIf	if(DSmall != 0.5 + sneakScale)	    Game.setGameSettingFloat("fSneakDetectionSizeSmall" , DSmall)	else		Game.setGameSettingFloat("fSneakDetectionSizeSmall" , 0.5)	endIf	if(DLarge != 1.5 + sneakScale)	    Game.setGameSettingFloat("fSneakDetectionSizeLarge" , DLarge)	else		Game.setGameSettingFloat("fSneakDetectionSizeLarge" , 1.5)	endIf	if(DVLarge != 2 + sneakScale)	    Game.setGameSettingFloat("fSneakDetectionSizeVeryLarge" , DVLarge)	else		Game.setGameSettingFloat("fSneakDetectionSizeVeryLarge" , 2)	endIf	if(MaxD != 40000)	    Game.setGameSettingFloat("fSneakMaxdistance" , MaxD)	else		Game.setGameSettingFloat("fSneakMaxdistance" , 2500)	endIfendFunction

EDIT: Note, that I did make music = MUSCombat, I think it might be connected to my issue.

User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am


Return to V - Skyrim