enderalse/scripts/source/_00e_combatsoundtrackscript.psc

40 lines
1.1 KiB
Plaintext

Scriptname _00E_CombatSoundtrackScript extends Actor
Event OnUpdate()
Actor player = Game.GetPlayer()
If player.IsInCombat()
RegisterForSingleUpdate(2.0)
ElseIf Triggered
Triggered = False
(player as _00E_PlayerFunctions).StopCombatMusic()
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()
If encounterLevel >= 20 || (encounterLevel >= (PlayerLevel.GetValue() - 15)) || HasKeyword(ActorTypeBoss) ; Frage ab ob Gegnerstufe über Spielerstufe oder Boss ist, wenn ja spiele Combatmusic
If Triggered == False ; player.IsInCombat() &&
Triggered = (player as _00E_PlayerFunctions).StartCombatMusic(_00E_Music_Combat_Regular)
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