enderalse/scripts/source/_00e_class_openclassmenuscript.psc

127 lines
3.6 KiB
Plaintext

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
If (MQP03.GetStage() <= 15) && (MQP03.IsRunning())
_00E_Class_MenuIMODIntro.Apply()
Wait(0.5)
PlayerREF.MoveTo(MQP03_PlayerStartMarker)
PlayerREF.SetAlpha(1.0)
MQP03.SetStage(20)
Else
if !(PlayerREF.IsInLocation(_00E_ClassMenuLocation))
If _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()
DisablePlayerControls(false, true, true, false, true, false, false, true)
Player.ForceRefTo(PlayerREF)
Bool isFirstPerson = False
isFirstPerson = PlayerREF.GetAnimationVariableBool("IsFirstPerson")
If isFirstPerson == true
_00E_Meditate_FirstPerson.SetValueInt(1)
Else
_00E_Meditate_FirstPerson.SetValueInt(0)
EndIf
if PlayerREF.IsWeaponDrawn()
PlayerREF.SheatheWeapon()
EndIf
Form[] equippedTorches = New Form[2]
(PlayerREF as _00E_PlayerFunctions).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)
DisablePlayerControls(false, true, 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