Removed CombatMusicControl

This commit is contained in:
Eddoursul 2024-02-05 03:17:04 +01:00
parent 16f10be14a
commit d3a52d735c
43 changed files with 26 additions and 278 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -403,7 +403,6 @@ scripts\_00e_chainactivatorbrownrockcave.pex
scripts\_00e_class_openclassmenuscript.pex
scripts\_00e_class_perkscript.pex
scripts\_00e_classmenuitemhandleraliasscript.pex
scripts\_00E_CombatMusicControl.pex
scripts\_00e_companion_purgesc.pex
scripts\_00e_completeobjective.pex
scripts\_00e_complex_addsilencesc.pex

View File

@ -2,8 +2,6 @@ Scriptname _00E_BrawlControl extends Quest Hidden
Function Brawl(Actor pTarget, Actor pTargetFriend = None)
_00E_PlayerFunctions.GetCombatMusicControl().IsStartingBrawling()
FavorBrawlEvent.SendStoryEvent(None, pTarget, pTargetFriend)
EndFunction

View File

@ -1,243 +0,0 @@
Scriptname _00E_CombatMusicControl extends Quest Hidden
MusicType[] ActiveCombatMusics
MusicType[] StoppingCombatMusics
Int StoppingCombatMusicCounter = 0
Int Property COMBAT_MUSIC_LOCK_NONE = 0 AutoReadOnly
Int Property COMBAT_MUSIC_LOCK_START = 1 AutoReadOnly
Int Property COMBAT_MUSIC_LOCK_STOP = 2 AutoReadOnly
Int Property COMBAT_MUSIC_LOCK_FAILSAFE = 3 AutoReadOnly
Int CombatMusicLockLevel = 0 ; = COMBAT_MUSIC_LOCK_NONE
Event OnInit()
; Yes, OnInit() runs in idle quests as well
InitCombatMusic() ; also called from OnPlayerLoadGame() in _00E_PlayerFunctions
EndEvent
Function InitCombatMusic()
RegisterForModEvent("Enderal_CombatStateChanged", "OnCombatStateChange")
If ActiveCombatMusics.Length == 0
ActiveCombatMusics = _NewMusicArray()
EndIf
If StoppingCombatMusics.Length == 0
StoppingCombatMusics = _NewMusicArray()
EndIf
If StoppingCombatMusicCounter > 0 || ActiveCombatMusics[0]
GoToState("CombatMusicTracking")
EndIf
EndFunction
function IsStartingBrawling()
bIsBrawling = true
RegisterForSingleUpdate(1.0)
endfunction
event OnUpdate()
bIsBrawling = false
endevent
Event OnCombatStateChange(string eventName, string bTargetIsPlayer, float fCombatState, Form sender)
return
if bTargetIsPlayer ; start combat or searching
if fCombatState as int == 1 ; combat
if bIsBrawling
bIsBrawling = false
if GetState() == ""
UnregisterForUpdate()
else
StopCombatMusic()
endif
return
endif
; start music
Actor sourceActor = sender as Actor
Int encounterLevel = sourceActor.GetLevel()
If encounterLevel >= 20 || (encounterLevel >= PlayerLevel.GetValue() - 15) || HasKeyword(ActorTypeBoss)
MusicType combatMusic
if _00E_ActorsCombatMusicEpic.HasForm(sourceActor.GetActorBase())
combatMusic = _00E_Music_Combat_Epic
elseif EnderalFunctions.IsInRegion(Wueste)
combatMusic = _00E_Music_Combat_Exotic
else
combatMusic = _00E_Music_Combat_Regular
endif
if StartCombatMusic(combatMusic)
RegisterForSingleUpdate(5.0)
EndIf
EndIf
elseif ! PlayerRef.IsInCombat()
if GetState() == ""
GoToState("CombatMusicTracking")
endif
RegisterForSingleUpdate(2.0)
endif
elseif ! PlayerRef.IsInCombat()
if GetState() == ""
GoToState("CombatMusicTracking")
endif
RegisterForSingleUpdate(2.0)
endif
endEvent
Bool Function StartCombatMusic(MusicType newMusic)
; Debug.Trace(self + ", StartCombatMusic, newMusic = " + newMusic)
Bool result = False
While CombatMusicLockLevel > COMBAT_MUSIC_LOCK_NONE
Utility.Wait(0.03) ; wait for two frames
EndWhile
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_START
Int Index = _AddUniqueMusicToArray(ActiveCombatMusics, newMusic)
If Index >= 0
ActiveCombatMusics[Index].Add()
result = (Index == 0) ; Is this the first combat music in this fight?
EndIf
StoppingCombatMusicCounter = 0
GoToState("CombatMusicTracking")
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_NONE
Return result
EndFunction
Function StopCombatMusic()
; Debug.Trace(self + ", StopCombatMusic")
While CombatMusicLockLevel > COMBAT_MUSIC_LOCK_NONE
If CombatMusicLockLevel == COMBAT_MUSIC_LOCK_START || CombatMusicLockLevel == COMBAT_MUSIC_LOCK_STOP
Return
EndIf
Utility.Wait(0.03)
EndWhile
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_STOP
Int Index = 0
While Index < ActiveCombatMusics.Length && ActiveCombatMusics[Index]
ActiveCombatMusics[Index].Remove()
_AddUniqueMusicToArray(StoppingCombatMusics, ActiveCombatMusics[Index])
Index += 1
EndWhile
ActiveCombatMusics = _NewMusicArray()
StoppingCombatMusicCounter = 8
GoToState("CombatMusicTracking")
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_NONE
EndFunction
State CombatMusicTracking
Event OnBeginState()
RegisterForSingleUpdate(0.1)
EndEvent
Event OnEndState()
UnregisterForUpdate()
EndEvent
Event OnUpdate()
RegisterForSingleUpdate(3.5)
If CombatMusicLockLevel > COMBAT_MUSIC_LOCK_NONE || PlayerRef.IsInCombat()
Return
EndIf
If StoppingCombatMusicCounter > 0
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_FAILSAFE
; Debug.Trace(self + ", OnUpdate: failsaving")
Int Index = 0
While Index < StoppingCombatMusics.Length && StoppingCombatMusics[Index]
StoppingCombatMusics[Index].Add()
StoppingCombatMusics[Index].Remove()
Index += 1
EndWhile
StoppingCombatMusicCounter -= 1
If StoppingCombatMusicCounter <= 0
StoppingCombatMusics = _NewMusicArray()
EndIf
CombatMusicLockLevel = COMBAT_MUSIC_LOCK_NONE
ElseIf ActiveCombatMusics[0] ; Failsafe in case StopCombatMusic is not called for whatever reason
StopCombatMusic()
Else
GoToState("")
EndIf
EndEvent
EndState
MusicType[] Function _NewMusicArray()
Return New MusicType[10]
EndFunction
Int Function _AddUniqueMusicToArray(MusicType[] musics, MusicType newMusic)
Int n = musics.Length
Int Index = 0
; Loop through array until we reach the end or newMusic or an empty entry
While Index < n && musics[Index] != newMusic && musics[Index] != None
Index += 1
EndWhile
If Index < n && musics[Index] == None
musics[Index] = newMusic
Return Index
Else
Return -1
EndIf
EndFunction
Function RemoveCombatSoundtracks()
int iIndex = _00E_MUS_AllCombatSoundtracks.GetSize()
while iIndex > 0
iIndex -= 1
MusicType musicToRemove = _00E_MUS_AllCombatSoundtracks.GetAt(iIndex) as MusicType
musicToRemove.Remove()
endwhile
EndFunction
bool bIsBrawling = false
Keyword Property ActorTypeBoss Auto
GlobalVariable Property PlayerLevel Auto
MusicType Property _00E_Music_Combat_Regular Auto
MusicType Property _00E_Music_Combat_Exotic Auto
MusicType Property _00E_Music_Combat_Epic Auto
FormList Property _00E_MUS_AllCombatSoundtracks Auto
FormList Property _00E_ActorsCombatMusicEpic Auto
Form Property Wueste Auto ; Powder Desert
Actor Property PlayerRef Auto

View File

@ -10,8 +10,6 @@ _00E_SafeItemRemove Property SafeItemRemove Auto
_00E_VisionControl Property VisionControl Auto
_00E_CombatMusicControl Property CombatMusicControl Auto
_00E_BrawlControl Property BrawlControl Auto
_00E_SoundControl Property SoundControl Auto

View File

@ -34,7 +34,7 @@ EndFunction
Function FinishUp()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_EPHandler.GiveEP(iRewardEXP)
FS_CQT01.CompleteAllObjectives()
FS_NQR04.SetCurrentStageID(85)
@ -46,7 +46,7 @@ Function FailQuest()
_00E_FS_CQT01_TharaelMsg.Show()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
FS_CQT01.FailAllObjectives()
FS_NQR04.SetCurrentStageID(85)

View File

@ -87,7 +87,7 @@ EndFunction
Function RefreshCombatState()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
FS_NQ01_YuslanREF.StopCombat()
FS_NQ01_YuslanREF.StopCombatAlarm()
@ -103,7 +103,7 @@ EndFunction
Function StartSC03()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_TeleportGlobal.SetValueInt(1)
FS_NQ01_SC03_MercenaryREF.Enable()
_00E_FS_NQ01_EventualityShiftIMOD.Apply()
@ -747,7 +747,7 @@ Function FinishUp()
UndercityBarracks2ZorkbansCellar.SetActorOwner(FS_NQ01_ZorkbanREF.GetActorBase())
Timescale.SetValue(10)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
CompleteQuest()
TeleportYuslan()
@ -776,7 +776,7 @@ Function FinishUpDreamflower()
UndercityBarracks2ZorkbansCellar.SetActorOwner(FS_NQ01_ZorkbanREF.GetActorBase())
Timescale.SetValue(10)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
TeleportYuslan()
EndFunction

View File

@ -184,7 +184,7 @@ Function FinishUp()
SetObjectiveCompleted(35)
_00E_Func_SetNPCAsCompanion.SetNPCAsCompanion(FS_NQR02_TharaelREF, False)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
_00E_EPHandler.GiveEP(__Config_iRewardEXP)
FS_NQR03.SetCurrentStageID(5)

View File

@ -277,7 +277,7 @@ Function FinishUp()
SetObjectiveCompleted(50) ; in case the player didn't teleport back with the brother greed
SetObjectiveCompleted(51)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
FS_NQR03_SC03_SecretDoorREF.SetOpen(False)
FS_NQR03_SC03_SecretDoorREF.BlockActivation(True)

View File

@ -300,7 +300,7 @@ Function FinishUp()
_00E_EPHandler.GiveEP(iRewardEXP)
AllowIdleChatter.SetValue(1)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
FS_NQR04_SC05_TharaelWalkAway.ForceStart()
FS_NQR05.SetCurrentStageID(5)

View File

@ -1826,7 +1826,7 @@ Function FinishUp()
CompleteAllObjectives()
Weather.ReleaseOverride()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
FS_NQR03_BrotherGreedREF.Disable()
FS_NQR05_SiteCampfireParentREF.Disable()
FS_NQR05_SC04_BrotherSorrowREF.Disable()

View File

@ -303,7 +303,7 @@ EndFunction
Function FinishQuest()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
EnablePlayerControls()
MQ03.SetCurrentStageID(5)
; SE: No such objective.

View File

@ -125,7 +125,7 @@ EndFunction
Function GiveRewardEXP()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_EPHandler.GiveEP(__Config_RewardEXP)
_00E_MC_KonstantinREF.EvaluatePackage()
_00E_MC_JesparREF.EvaluatePackage()

View File

@ -5,7 +5,7 @@ Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == PlayerREF && MQ07b.GetCurrentStageID() == 35
AllowIdleChatter.SetValue(0)
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
if !MQ07b_SC02_Lishari.IsPlaying()
MQ07b_SC02_Lishari.ForceStart()
@ -23,4 +23,4 @@ Actor Property PlayerREF Auto
Quest Property MQ07b Auto
Scene Property MQ07b_SC02_Lishari Auto
Scene Property MQ07b_SC02_Lishari Auto

View File

@ -631,7 +631,7 @@ Function FinishQuest()
MQ07b_NuminosREF.Disable()
_00E_EPHandler.GiveEP(__Config_iRewardEXP)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
if akCompanion == _00E_MC_CaliaREF
_00E_MC_CaliaREF.SetOutfit(_00E_MC_Calia_Outfit)

View File

@ -718,7 +718,7 @@ Function GetIntoTemple()
_00E_Music_Special_Romance.Remove()
_00E_SilenceAbruptHighPriority.Remove()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_Music_Special_Cleansing.Add()
EndFunction

View File

@ -7,7 +7,7 @@ Import Utility
;=====================================================================================
Event OnUpdate()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
EndEvent
;=====================================================================================
@ -88,7 +88,7 @@ EndFunction
Function StartSC02()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
NQ_G_03_SC02_PetrifiedExamineCaravan.ForceStart()

View File

@ -772,7 +772,7 @@ Function StartKontorCombat()
NQG07_TheaterDoor_01.BlockActivation(True)
NQG07_TheaterDoor_02.BlockActivation(True)
_00E_SilenceAbruptHighPriority.Remove()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
wait(0.1)
@ -1070,7 +1070,7 @@ EndFunction
Function CleanSounds()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
EndFunction
@ -1085,7 +1085,7 @@ Function FinishQuest()
_00E_NQ_G_07_RogashREF.Enable()
ReEnablePrisonGuards()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
if bDijaamHanged == true
@ -1112,7 +1112,7 @@ Function FinishQuestDijaam()
ReEnablePrisonGuards()
NQG07Dijaam_SC4_EscapeCollision.Disable()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
EndFunction
@ -1130,7 +1130,7 @@ Function FinishQuestDijaamLeora()
ResetGraveyardScene()
_00E_EPHandler.GiveEP(__Config_RewardEXP)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
EndFunction

View File

@ -659,7 +659,7 @@ Function GiveRewardEXP(bool bDeclined)
_00E_SC_TharaelREF.UnEquipItemEx(_00E_FS_NQR05_Tharael_Dagger, 1, true)
_00E_SC_TharaelREF.UnEquipItemEx(_00E_FS_NQR05_Tharael_Dagger, 2, true)
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
AllowIdleChatter.SetValue(1)
NQR01_SC05_Explanation.Stop()
SetObjectiveCompleted(50)

View File

@ -39,10 +39,6 @@ _00E_VisionControl function GetVisionControl() Global
return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.VisionControl
endfunction
_00E_CombatMusicControl function GetCombatMusicControl() Global
return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.CombatMusicControl
endfunction
_00E_FadeToBlackControl function GetFadeToBlackControl() Global
return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.FadeToBlackControl
endfunction

View File

@ -5,7 +5,7 @@ Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == PlayerREF && !bDone
bDone = True
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
EndIf
EndEvent

View File

@ -10,7 +10,7 @@ Event OnTriggerEnter(ObjectReference akActionRef)
_00E_MQ17_Purge_Weather.ForceActive(True)
_00E_Music_Special_Cleansing.Add()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
_00E_PlayerFunctions.GetCombatMusicControl().RemoveCombatSoundtracks()
_00E_PlayerFunctions.GetSoundControl().RemoveCombatSoundtracks()
_00E_SilenceAbruptHighPriority.Remove()
_00E_Music_Special_Cleansing.Add()
EndIf