Scriptname _00E_CQC05_Functions extends Quest Conditional ;===================================================================================== ; FUNCTIONS ;===================================================================================== Function SetUp() If _00E_MC_CaliaREF.IsDisabled() _00E_MC_CaliaREF.Enable() EndIf wpnCalia = _00E_MC_CaliaREF.GetEquippedWeapon() _00E_MC_CaliaREF.UnequipItem(wpnCalia, true) _00E_MC_CaliaREF.UnequipItem(_01E_20Huetergrossschwert, true) _00E_MC_CaliaREF.EquipItem(Torch01, True) _00E_MC_CaliaREF.RemoveItem(_01E_20Huetergrossschwert, 1) _00E_MC_CaliaREF.SetOutfit(_00E_MC_Calia_SimpleClothing) _00E_MC_CaliaREF.MoveTo(CQC05_SC01_CaliaSpawn) EndFunction Function EnableKurmai() _00E_SC_KurmaiREF.Enable() _00E_SC_KurmaiREF.EquipItem(Torch01, true) PlayerREF.UnEquipItem(PlayerREF.GetEquippedWeapon(1), false, true) PlayerREF.UnEquipItem(PlayerREF.GetEquippedWeapon(0), false, true) PlayerREF.UnequipItem(PlayerREF.GetEquippedShield(), false, true) CQC05_SC02_StarshipSpiderREF.Enable() CQC05_SC02_StarshipSpiderREF.SetAlpha(1.0) _00E_SC_KurmaiREF.MoveTo(CQC05_SC01_KurmaiAppearMarker) CQC05_SC02_StarshipSpiderREF.MoveTo(CQC05_SC01_KurmaiAppearMarker) CQC05_SC02_CaliaRomance02.ForceStart() EndFunction Function MoveCaliaFailsave() _00E_MC_CaliaREF.MoveTo(CQC05_SC01_KurmaiAppearMarker004) EndFunction Int Function GetHandSlotEx(int iHand) ; iHand = 0 for left hand, 1 for right hand ; In SKSE "Equip Ex" functions: iHand = 2 for left hand, 1 for right hand Return 2 - iHand EndFunction Function EnableInvisibleWall() _00E_MC_CaliaREF.UnequipItem(Torch01, True) Int iHand = 0 if PlayerREF.GetEquippedItemType(iHand) == 11 Form torch = PlayerREF.GetEquippedObject(iHand) PlayerREF.UnequipItemEx(torch, GetHandSlotEx(iHand)) endif _00E_MC_CaliaREF.RemoveItem(Torch01, 1, True) ;PlayerREF.UnEquipItem(Torch01, True) CQC05_LoseGameTGBXREF.Enable() EndFunction Function CloseDoor() _00E_SC_KurmaiREF.MoveTo(MQ13a_SC07_KurmaiKneelMarker) CQC05_SC02_StarshipSpiderREF.Disable() CQC05_SC02_DoorREF.SetOpen(False) EndFunction Function MoveKurmaiFailsave() _00E_SC_KurmaiREF.MoveTo(MQ13a_SC07_KurmaiKneelMarker) EndFunction Function AddRomanceMusic() _00E_Music_Special_Character_CaliaShort.Remove() _00E_Music_Special_Romance.Add() EndFunction Function GetIntoPositionIfRomance() ; if CaliaFlirtCounter.GetValueInt() >= 4 && (RomanceLockedCalia.GetValueInt() == 0) Game.ForceThirdPerson() _00E_Func_AIWalk.PlayerAIWalk(False) ; EndIf EndFunction Function ReEnableControlsIfNoRomance() if CaliaFlirtCounter.GetValueInt() < 4 || (RomanceLockedCalia.GetValueInt() == 1) _00E_Func_AIWalk.PlayerAIWalkStop() Game.EnablePlayerControls() EndIf EndFunction Function PlayerRomance() EndFunction Function AddMusic() _00E_Music_Special_Character_CaliaShort.Add() EndFunction Function PortIntoPosition() _00E_MC_CaliaREF.TranslateToRef(CQC05_SC02_CaliaIdle, 10) PlayerREF.TranslateToRef(CQC02_SC02_PlayerIdleMarker, 10) EndFunction Function PlayKiss() ; Solves "torch in body" problem while kissing _00E_MC_CaliaREF.UnEquipItem(Torch01, True) _FS_TheriantrophistControlQuest.TransformBackIfTransformed() If Player.GetRace() == HighElfRace fPlayerScale = _00E_SetActorScale.Change(PlayerREF, 0.92) EndIf Int iHand = 0 if PlayerREF.GetEquippedItemType(iHand) == 11 Form torch = PlayerREF.GetEquippedObject(iHand) PlayerREF.UnequipItemEx(torch, GetHandSlotEx(iHand)) endif _00E_MC_CaliaREF.RemoveItem(Torch01, 1, True) PlayerREF.EquipItem(_00E_InvisibleHelmet_Armor, false, true) Utility.Wait(0.1) PlayerREF.RemoveItem(_00E_InvisibleHelmet_Armor, 1, true) Utility.Wait(2) Debug.ToggleMenus() AudioCategoryMAG.SetVolume(0.5) AudioCategorySFX.SetVolume(0.5) _00E_CameraControl.LockVanityCamera() Game.SetPlayerAIDriven(True) Game.DisablePlayerControls(true, true, true, false, true, true, true, true) Game.ForceThirdPerson() Utility.Wait(0.5) If Player.GetSex() == 0 PlayerREF.PlayIdleWithTarget(pa_Idle_Kiss_FemaleMale, _00E_MC_CaliaREF) Else PlayerREF.PlayIdleWithTarget(pa_Idle_Kiss_FemaleFemale, _00E_MC_CaliaREF) EndIf Utility.Wait(0.5) PlayerREF.SetUnconscious(True) _00E_MC_CaliaREF.SetUnconscious(True) PlayerREF.AddSpell(_00E_Game_abSlowTime, false) Utility.Wait(7) bKissAnimationPlayer = True FadeOut() EndFunction Function FadeOut() If _00E_MC_CaliaREF.IsDisabled() _00E_MC_CaliaREF.Enable() EndIf CQC05_SC02_DoorREF.BlockActivation(True) CaliaRomance.SetValueInt(1) FadeToBlackIMOD.Apply() Utility.Wait(2) FadeToBlackHoldIMOD.ApplyCrossFade(1) Utility.Wait(1) PlayerREF.SetScale(1.0) ; TODO, Gavrant, 2021-06-21: probably delete it. There is another revert of the scale later, in FadeBack. _00E_MC_CaliaREF.SetUnconscious(False) PlayerREF.SetUnconscious(False) PlayerREF.PlayIdle(IdleStop_Loose) _00E_MC_CaliaREF.PlayIdle(IdleStop_Loose) Debug.SendAnimationEvent(PlayerREF, "returnToDefault") Debug.SendAnimationEvent(_00E_MC_CaliaREF, "returnToDefault") PlayerREF.RemoveSpell(_00E_Game_abSlowTime) _00E_Func_AIWalk.PlayerAIWalk() _00E_MC_CaliaREF.MoveTo(CQC05_SC02_CaliaLedgeRef) PlayerREF.MoveTo(CQC05_SC02_PlayerWakeUp) PlayerREF.SetPosition(CQC05_SC02_PlayerWakeUp.GetPositionX(), CQC05_SC02_PlayerWakeUp.GetPositionY(), CQC05_SC02_PlayerWakeUp.GetPositionZ()) Utility.Wait(7) CQC05_SC02_PlayerWakeUp.Activate(PlayerREF, true) PlayerREF.UnequipAll() Debug.ToggleMenus() _00E_MC_CaliaREF.UnequipAll() _00E_MC_CaliaREF.AddItem(_00E_Calia_Necklace) _00E_SC_KurmaiREF.UnEquipItem(Torch01) CQC05_SC03_Romance.ForceStart() EndFunction Function FadeBack() If Player.GetRace() == HighElfRace PlayerREF.SetScale(fPlayerScale) EndIf String facegen = "bUseFaceGenPreprocessedHeads:General" Utility.SetINIBool(facegen, False) PlayerREF.QueueNiNodeUpdate() Utility.SetINIBool(facegen, True) AudioCategoryMAG.SetVolume(1.0) AudioCategorySFX.SetVolume(1.0) FadeToBlackBackIMOD.ApplyCrossFade() _00E_Func_AIWalk.PlayerAIWalkStop() Game.EnablePlayerControls() _00E_CameraControl.UnlockVanityCamera() _00E_Func_RefreshFace.RefreshFace() _00E_MC_CaliaREF.UnequipAll() Utility.Wait(0.1) _00E_MC_CaliaREF.EquipItem(_00E_Calia_Necklace) _00E_Music_Special_Romance.Remove() CQC05_SC02_PlayerWakeUp.Activate(PlayerREF, True) EndFunction Function Reequip() FadeToBlackAndBackIMOD.Apply() Utility.Wait(3) _00E_MC_CaliaREF.SetOutfit(_00E_MC_Calia_Outfit) _00E_MC_CaliaREF.AddItem(_01E_20Huetergrossschwert) _00E_MC_CaliaREF.EquipItem(_01E_20Huetergrossschwert) SetStage(55) MQ13a.SetStage(80) EndFunction Function CompleteAndGiveEP() _00E_Func_AIWalk.PlayerAIWalkStop() _00E_SC_KurmaiREF.UnEquipItem(Torch01) CQC05_SC02_DoorREF.SetOpen(True) CQC05_SC02_DoorREF.BlockActivation(False) Game.ShowFirstPersonGeometry(True) Game.EnablePlayerControls() _00E_EPHandler.GiveEP(__Config_iRewardEXP) SetObjectiveCompleted(5) If _00E_AchievementsEnabled.GetValueInt() == 1 Steam.UnlockAchievement("END_COMPLETE_CALIA_01") EndIf EndFunction Function PlaySadBeep() _00E_NPCDwarvenSpiderSadBeepM.Play(_00E_SC_KurmaiREF) EndFunction ;===================================================================================== ; PROPERTIES ;===================================================================================== float fPlayerScale bool Property bKissAnimationPlayer Auto Conditional Hidden int Property __Config_iRewardEXP = 500 Auto Actor Property _00E_MC_CaliaREF Auto Actor Property CQC05_SC02_StarshipSpiderREF Auto Actor Property PlayerREF Auto Actor Property _00E_SC_KurmaiREF Auto Armor Property _00E_InvisibleHelmet_Armor Auto Armor Property _00E_Calia_Necklace Auto ActorBase Property Player Auto Race Property HighElfRace Auto Weapon wpnCalia SoundCategory Property AudioCategoryMAG Auto SoundCategory Property AudioCategorySFX Auto GlobalVariable Property CaliaRomance Auto GlobalVariable Property CaliaFlirtCounter Auto GlobalVariable Property RomanceLockedCalia Auto GlobalVariable Property _00E_AchievementsEnabled Auto Weapon Property _01E_20Huetergrossschwert Auto ImageSpaceModifier Property FadeToBlackIMOD Auto ImageSpaceModifier Property FadeToBlackHoldIMOD Auto ImageSpaceModifier Property FadeToBlackBackIMOD Auto ImageSpaceModifier Property FadeToBlackAndBackIMOD Auto ObjectReference Property CQC05_SC01_CaliaSpawn Auto ObjectReference Property CQC05_SC01_KurmaiAppearMarker Auto ObjectReference Property CQC05_SC02_DoorREF Auto ObjectReference Property CQC05_SC02_PlayerWakeUp Auto ObjectReference Property CQC05_SC02_CaliaIdle Auto ObjectReference Property CQC05_SC01_KurmaiAppearMarker004 Auto ObjectReference Property CQC02_SC02_PlayerIdleMarker Auto ObjectReference Property MQ13a_SC07_KurmaiKneelMarker Auto ObjectReference Property CQC05_SC02_CaliaLedgeRef Auto ObjectReference Property CQC05_LoseGameTGBXREF Auto Spell Property _00E_Game_abSlowTime Auto Light Property Torch01 Auto Idle Property pa_Idle_Kiss_FemaleFemale Auto Idle Property pa_Idle_Kiss_FemaleMale Auto Idle Property IdleStop_Loose Auto Sound Property _00E_NPCDwarvenSpiderSadBeepM Auto Quest Property MQ13a Auto Outfit Property _00E_MC_Calia_SimpleClothing Auto Outfit Property _00E_MC_Calia_Outfit Auto MusicType Property _00E_Music_Special_Character_CaliaShort Auto MusicType Property _00E_Music_Special_Romance Auto Scene Property CQC05_SC02_CaliaRomance02 Auto Scene Property CQC05_SC03_Romance Auto