enderalse/source/scripts/_00e_class_openclassmenuscript.psc

123 lines
3.7 KiB
Plaintext
Raw Normal View History

Scriptname _00E_Class_OpenClassMenuScript extends activemagiceffect
Import Utility
Import Game
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor TheTarget, Actor TheCaster)
If _00E_Meditate_PlayerIsTeleporting.GetValue() != 0
Return
EndIf
_00E_Meditate_PlayerIsTeleporting.SetValue(1)
Bool bDoSettleDownWait = True
2024-01-10 14:08:24 +00:00
If (MQP03.GetCurrentStageID() <= 15) && (MQP03.IsRunning())
_00E_Class_MenuIMODIntro.Apply()
Wait(0.5)
PlayerREF.MoveTo(MQP03_PlayerStartMarker)
PlayerREF.SetAlpha(1.0)
2024-01-10 14:08:24 +00:00
MQP03.SetCurrentStageID(20)
Else
if !(PlayerREF.IsInLocation(_00E_ClassMenuLocation))
If PlayerREF.GetRace() == _00E_Theriantrophist_PlayerWerewolfRace || _00E_Meditate_Allowed.GetValueInt() == 0
_00E_Meditation_sCantMeditateNow.Show()
bDoSettleDownWait = False
ElseIf PlayerREF.IsInCombat()
_00E_Meditation_sCantMeditateWithEnemies.Show()
bDoSettleDownWait = False
Else
EnterClassMenu()
EndIf
else
ExitClassMenu()
endif
EndIf
If bDoSettleDownWait ; Give a few moments for things to settle down before allowing another teleport
Wait(0.75)
EndIf
_00E_Meditate_PlayerIsTeleporting.SetValue(0)
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function EnterClassMenu()
bool bDisableFighting = SKSE.GetVersion() > 0 && ! EnderalFunctions.IsVR()
2024-02-08 06:45:07 +00:00
DisablePlayerControls(false, bDisableFighting, true, false, true, false, false, true)
Player.ForceRefTo(PlayerREF)
2024-02-13 09:02:30 +00:00
_00E_Meditate_FirstPerson.SetValue(PlayerREF.GetAnimationVariableBool("isFirstPerson") as float)
_00E_EquipControl.SheatheWeapon(PlayerREF)
Form[] equippedTorches = New Form[2]
_00E_TorchControl.UnequipTorches(equippedTorches)
_00E_RealWorldOrigin.MoveTo(playerREF)
_00E_Class_MenuMeditationSound.Play(PlayerREF)
_00E_Class_MenuIMODIntro.Apply()
Wait(0.7)
PlayerREF.MoveTo(_00E_ClassMenuOrigin)
Game.ShowFirstPersonGeometry(False)
2024-02-08 06:45:07 +00:00
DisablePlayerControls(false, bDisableFighting, true, false, true, false, false, true)
ForceFirstPerson()
EndFunction
Function ExitClassMenu()
_00E_Class_MenuMeditationSound.Play(PlayerREF)
_00E_Class_MenuIMODIntro.Apply()
Wait(0.7)
PlayerREF.MoveTo(_00E_RealWorldOrigin)
PlayerREF.SetAlpha(1.0)
Player.Clear()
Game.EnablePlayerControls()
Game.ShowFirstPersonGeometry(True)
If _00E_Meditate_FirstPerson.GetValueInt() == 0
Game.ForceThirdPerson()
EndIf
Game.RequestAutoSave()
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor Property PlayerREF Auto
ImagespaceModifier Property _00E_Class_MenuIMODIntro Auto
Quest Property MQP03 Auto
Sound Property _00E_Class_MenuMeditationSound Auto
Location property _00E_ClassMenuLocation Auto
ObjectReference Property _00E_ClassMenuOrigin Auto
ObjectReference Property _00E_RealWorldOrigin Auto
ObjectReference Property MQP03_PlayerStartMarker Auto
Message Property _00E_Meditation_sCantMeditateWithEnemies Auto
Message Property _00E_Meditation_sCantMeditateNow Auto
GlobalVariable Property _00E_Meditate_PlayerIsTeleporting Auto
GlobalVariable Property _00E_Meditate_FirstPerson Auto
GlobalVariable Property _00E_Meditate_Allowed Auto
ReferenceAlias Property Player Auto
Race Property _00E_Theriantrophist_PlayerWerewolfRace Auto