2021-10-06 00:15:58 +02:00
Scriptname _00E_CombatSoundtrackScript extends Actor
Event OnUpdate()
Actor player = Game.GetPlayer()
If player.IsInCombat()
RegisterForSingleUpdate(2.0)
ElseIf Triggered
Triggered = False
2024-01-09 23:00:18 +01:00
_00E_PlayerFunctions.GetCombatMusicControl().StopCombatMusic()
2021-10-06 00:15:58 +02:00
EndIf
EndEvent
Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
If !_00E_Music_Combat_Regular
Debug.Trace(self + ": _00E_Music_Combat_Regular property is empty")
Return
EndIf
If aeCombatState == 1
Actor player = Game.GetPlayer()
If akTarget == player
Int encounterLevel = GetLevel()
2024-01-09 23:00:18 +01:00
If encounterLevel >= 20 || (encounterLevel >= (PlayerLevel.GetValue() - 15)) || HasKeyword(ActorTypeBoss) ; Frage ab ob Gegnerstufe über Spielerstufe oder Boss ist, wenn ja spiele Combatmusic
2021-10-06 00:15:58 +02:00
If Triggered == False ; player.IsInCombat() &&
2024-01-09 23:00:18 +01:00
Triggered = _00E_PlayerFunctions.GetCombatMusicControl().StartCombatMusic(_00E_Music_Combat_Regular)
2021-10-06 00:15:58 +02:00
If Triggered
RegisterForSingleUpdate(5.0)
EndIf
EndIf
EndIf
EndIf
EndIf
EndEvent
MusicType Property _00E_Music_Combat_Regular Auto
GlobalVariable Property PlayerLevel Auto
Keyword Property ActorTypeBoss Auto
Bool Triggered = False