enderalse/source/scripts/_00e_fs_nqr05_bossfight_tharaelsc.psc

321 lines
10 KiB
Plaintext

Scriptname _00E_FS_NQR05_Bossfight_TharaelSC extends ReferenceAlias
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEnterBleedout()
If FS_NQR05_SidedWithFather.GetValueInt() == 1
FS_NQR05.StopMusic()
EndIf
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If FS_NQR05.GetStage() == 320
If !bIsEnemy && FS_NQR05_SidedWithTharael.GetValueInt() == 0 && FS_NQR05_SidedWithFather.GetValueInt() == 0
If !bSideChosen && akAggressor == PlayerREF
SideAgainstTharael()
EndIf
ElseIf _00E_FS_NQR05_TharaelSpecialAttackOngoing.GetValueInt() == 1
FS_NQR05_FatherREF.Say(FS_NQR05_D00_Bossfight_OnHitTopic)
EndIf
EndIf
EndEvent
Event OnUpdate()
If !Self.GetActorReference().IsBleedingOut()
CastSpecialAttack()
EndIf
EndEvent
Event OnDeath(Actor akKiller)
FS_NQR05.SetStage(325)
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function SideAgainstTharael()
bIsEnemy = true
bSideChosen = true
FS_NQR05_TharaelREF.GetActorBase().SetEssential(True)
FS_NQR05_TharaelREF.BlockActivation()
FS_NQR05_SidedWithTharael.SetValueInt(0)
FS_NQR05_SidedWithFather.SetValueInt(1)
FS_NQR05.SideWithCharacter(FS_NQR05_FatherREF)
If FS_NQR05.GetStage() < 325 ; just in case the player one-shots Tharaêl
RegisterForSpecialAttack(20.0)
EndIf
EndFunction
Function RegisterForSpecialAttack(float fSeconds)
RegisterForSingleUpdate(fSeconds)
EndFunction
Function CastSpecialAttack()
If !FS_NQR05_TharaelREF.IsDead()
fDamageDone = (FS_NQR05_TharaelREF.GetBaseAV("Health") - FS_NQR05_TharaelREF.GetAV("Health"))
FS_NQR05_TharaelREF.Say(FS_NQR05_D99_TharaelLaunch_BossfightTopic)
FS_NQR05_FatherREF.SetGhost(True)
_00E_FS_NQR05_TharaelSpecialAttackOngoing.SetValueInt(1)
FS_NQR05_FatherREF.SheatheWeapon()
FS_NQR05_FatherREF.StopCombat()
FS_NQR05_FatherREF.StopCombatAlarm()
FS_NQR05_FatherREF.EvaluatePackage()
FS_NQR05_TharaelREF.EvaluatePackage()
FS_NQR05_TharaelREF.PlayIdle(_00E_IdleStomp)
FS_NQR05_TharaelREF.SetGhost(true)
_00E_FS_NQR05_TharaelEffect.Play(FS_NQR05_TharaelREF)
FS_NQR05_TharaelREF.SetAlpha(0.5)
_00E_FS_NQR05_TharaelTeleportShock.Apply()
FS_NQR05_TharaelREF.KnockAreaEffect(1.0, 2048)
FS_NQR05_TharaelREF.PlaceAtMe(_00E_FS_NQR05_TharaelBanish)
If !objLight
objLight = FS_NQR05_TharaelREF.PlaceAtMe(_00E_FS_NQR05_TharaelSpecialAttackLight)
Else
objLight.Enable()
EndIf
If FS_NQR05_FatherREF.IsBleedingOut()
FS_NQR05_FatherREF.RestoreAV("Health", 250)
Utility.Wait(3)
EndIf
Father.TeleportToCenter()
FS_NQR05_FatherREF.Say(FS_NQR05_D00_Bossfight_WarningTopic)
StartVolley()
EndIf
EndFunction
Function StartVolley()
_00E_FS_NQR05_TharaelSpecialAttackOngoing.SetValueInt(1)
FS_NQR05_TharaelREF.AddItem(_00E_FS_NQR05_TharaelSpectralBow, 1)
FS_NQR05_TharaelREF.AddItem(_00E_FS_NQR05_TharaelAmmo, 7)
FS_NQR05_TharaelREF.RemoveItem(_00E_FS_NQR05_Tharael_Dagger, 1)
FS_NQR05_TharaelREF.EquipItem(_00E_FS_NQR05_TharaelSpectralBow, true, true)
FS_NQR05_TharaelREF.EquipItem(_00E_FS_NQR05_TharaelAmmo, true, true)
bFirstAttack = false
FS_NQR05_TharaelREF.SetLookAt(PlayerREF)
Utility.Wait(0.5)
TeleportToRandomPosition()
EndFunction
int Function GetClosest(float[] arrayToCheck)
float iSmallest
int iIndex = 0
int iOutputIndex
iSmallest = arrayToCheck[0]
while iIndex < arrayToCheck.Length
If (arrayToCheck[iIndex] < iSmallest)
iSmallest = arrayToCheck[iIndex]
iOutputIndex = iIndex
EndIf
iIndex += 1
EndWhile
Return iOutputIndex
EndFunction
Function TeleportToRandomPosition()
float[] fDistances
ObjectReference[] teleportPositions
teleportPositions = new ObjectReference[8]
teleportPositions[0] = FS_NQR05_Tharael_TeleportMarker_005
teleportPositions[1] = FS_NQR05_Tharael_TeleportMarker_006
teleportPositions[2] = FS_NQR05_Tharael_TeleportMarker_007
teleportPositions[3] = FS_NQR05_Tharael_TeleportMarker_008
teleportPositions[4] = FS_NQR05_Tharael_TeleportMarker_009
teleportPositions[5] = FS_NQR05_Tharael_TeleportMarker_010
teleportPositions[6] = FS_NQR05_Tharael_TeleportMarker_011
teleportPositions[7] = FS_NQR05_Tharael_TeleportMarker_012
fDistances = new float[8]
fDistances[0] = FS_NQR05_Tharael_TeleportMarker_005.GetDistance(PlayerREF)
fDistances[1] = FS_NQR05_Tharael_TeleportMarker_006.GetDistance(PlayerREF)
fDistances[2] = FS_NQR05_Tharael_TeleportMarker_007.GetDistance(PlayerREF)
fDistances[3] = FS_NQR05_Tharael_TeleportMarker_008.GetDistance(PlayerREF)
fDistances[4] = FS_NQR05_Tharael_TeleportMarker_009.GetDistance(PlayerREF)
fDistances[5] = FS_NQR05_Tharael_TeleportMarker_010.GetDistance(PlayerREF)
fDistances[6] = FS_NQR05_Tharael_TeleportMarker_011.GetDistance(PlayerREF)
fDistances[7] = FS_NQR05_Tharael_TeleportMarker_012.GetDistance(PlayerREF)
ObjectReference objClosestPoint = teleportPositions[GetClosest(fDistances)]
If objClosestPoint.GetDistance(FS_NQR05_TharaelREF) >= 100
_00E_FS_NQR05_TharaelTeleportShockSmallIMOD.Apply()
_00E_FS_Tharael_DematerializeFXS.Play(FS_NQR05_TharaelREF)
Utility.Wait(0.2)
Teleport(objClosestPoint)
objLight.MoveTo(objClosestPoint)
EndIf
FS_NQR05_TharaelREF.SetLookAt(PlayerREF)
Utility.Wait(0.5)
iArrowsToFire = 1
Shoot()
EndFunction
Function Teleport(ObjectReference objLocation)
FS_NQR05_TharaelREF.MoveTo(objLocation)
_00E_QuestFunctions.WaitForReferenceToLoad(FS_NQR05_TharaelREF)
MAGIllusionReleaseAimedSDM.Play(FS_NQR05_TharaelREF)
_00E_FS_NQR05_TharaelMaterializeFXS.Play(FS_NQR05_TharaelREF)
EndFunction
Function Shoot()
float TargetAngleX = PlayerREF.GetAngleX()
float TargetAngleY = PlayerREF.GetAngleY()
float TargetAngleZ = (PlayerREF.GetAngleZ()) + 180
FS_NQR05_TharaelREF.TranslateTo(FS_NQR05_TharaelREF.GetPositionX(), FS_NQR05_TharaelREF.GetPositionY(), FS_NQR05_TharaelREF.GetPositionZ(), TargetAngleX, TargetAngleY, TargetAngleZ, 400.0, 400.0)
Debug.SendAnimationEvent(FS_NQR05_TharaelREF, "bowAttackStart")
Utility.Wait(2)
WPNBowFire.Play(FS_NQR05_TharaelREF)
FS_NQR05_TharaelREF.SetAngle(TargetAngleX, TargetAngleY, TargetAngleZ)
_00E_FS_NQR05_Tharael_SpectralArrow.Cast(FS_NQR05_TharaelREF, PlayerREF)
Debug.SendAnimationEvent(FS_NQR05_TharaelREF, "attackStop")
iArrowsToFire -= 1
FS_NQR05_TharaelREF.RemoveItem(_00E_FS_NQR05_TharaelAmmo, 1)
Utility.Wait(0.25)
If FS_NQR05_TharaelREF.GetItemCount(_00E_FS_NQR05_TharaelAmmo) == 0
StopSpecialAttack()
Else
TeleportToRandomPosition()
EndIf
EndFunction
Function StopSpecialAttack()
_00E_FS_NQR05_TharaelEffect.Stop(FS_NQR05_TharaelREF)
FS_NQR05_TharaelREF.SetAlpha(1)
_00E_FS_NQR05_TharaelSpecialAttackOngoing.SetValueInt(0)
FS_NQR05_TharaelREF.UnequipItem(_00E_FS_NQR05_TharaelSpectralBow)
FS_NQR05_TharaelREF.RemoveItem(_00E_FS_NQR05_TharaelSpectralBow, 1)
FS_NQR05_TharaelREF.equipitemex(_00E_FS_NQR05_Tharael_Dagger, 1, False)
FS_NQR05_TharaelREF.equipitemex(_00E_FS_NQR05_Tharael_Dagger, 0, False)
objLight.Disable()
FS_NQR05_TharaelREF.Reset()
FS_NQR05_TharaelREF.DamageAV("Health", fDamageDone)
FS_NQR05_TharaelREF.ClearLookAt()
Teleport(FS_NQR05_Tharael_ReappearMarkerREF001)
_00E_FS_Tharael_DematerializeFXS.Stop(FS_NQR05_TharaelREF)
_00E_FS_NQR05_TharaelMaterializeFXS.Stop(FS_NQR05_TharaelREF)
_00E_FS_NQR05_TharaelEffect.Stop(FS_NQR05_TharaelREF)
FS_NQR05_TharaelREF.SetAlpha(1.0)
FS_NQR05_TharaelREF.EvaluatePackage()
FS_NQR05_TharaelREF.StartCombat(PlayerREF)
FS_NQR05_TharaelREF.SetGhost(False)
If FS_NQR05.GetStage() < 325
RegisterForSpecialAttack(30.0)
EndIf
Father.TeleportBack()
FS_NQR05_FatherREF.EvaluatePackage()
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
int iArrowsToFire
float fDamageDone
bool Property bSideChosen Auto Conditional Hidden
bool bIsEnemy
bool bFirstAttack
ObjectReference objLight
_00E_FS_NQR05_Bossfight_FatherSC Property Father Auto
_00E_FS_NQR05_Functions Property FS_NQR05 Auto
Actor Property FS_NQR05_FatherREF Auto
Actor Property FS_NQR05_TharaelREF Auto
Actor Property PlayerREF Auto
Weapon Property _00E_FS_NQR05_TharaelSpectralBow Auto
Weapon Property _00E_FS_NQR05_Tharael_Dagger Auto
Ammo Property _00E_FS_NQR05_TharaelAmmo Auto
Topic Property FS_NQR05_D00_Bossfight_WarningTopic Auto
Topic Property FS_NQR05_D00_Bossfight_OnHitTopic Auto
Topic Property FS_NQR05_D99_TharaelLaunch_BossfightTopic Auto
Idle Property _00E_IdleStomp Auto
Idle Property bowAttack Auto
Light Property _00E_FS_NQR05_TharaelSpecialAttackLight Auto
Sound Property WPNBowFire Auto
Sound Property MAGIllusionReleaseAimedSDM Auto
Spell Property _00E_FS_NQR05_Tharael_SpectralArrow Auto
VisualEffect Property _00E_FS_NQR05_TharaelEffect Auto
EffectShader Property _00E_FS_NQR05_TharaelMaterializeFXS Auto
EffectShader Property _00E_FS_Tharael_DematerializeFXS Auto
ImageSpaceModifier Property _00E_FS_NQR05_TharaelTeleportShock Auto
ImageSpaceModifier Property _00E_FS_NQR05_TharaelTeleportShockSmallIMOD Auto
Explosion Property _00E_FS_NQR05_TharaelBanish Auto
GlobalVariable Property _00E_FS_NQR05_TharaelSpecialAttackOngoing Auto
GlobalVariable Property FS_NQR05_SidedWithFather Auto
GlobalVariable Property FS_NQR05_SidedWithTharael Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_005 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_006 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_007 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_008 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_009 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_010 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_011 Auto
ObjectReference Property FS_NQR05_Tharael_TeleportMarker_012 Auto
ObjectReference Property FS_NQR05_Tharael_ReappearMarkerREF001 Auto