-
Notifications
You must be signed in to change notification settings - Fork 0
/
INEQ_ThrowVoice.psc
113 lines (96 loc) · 3.86 KB
/
INEQ_ThrowVoice.psc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Scriptname INEQ_ThrowVoice extends INEQ_AbilityBase1H
{Attached to the ability's magic effect}
;=========================================== Properties ===========================================================================>
Message Property MainMenu Auto
Sound Property INEQ__ShoutFail Auto
Spell Property ThrowVoiceSpell Auto
int Property ShoutTime Auto Hidden
;========================================== Autoreadonly ==========================================================================>
int Property DEFShoutTime = 5 Autoreadonly
String Property BashExit = "bashExit" Autoreadonly ; End bashing
;=========================================== Variables ============================================================================>
bool bBalanced
bool bUseShoutCharge
;===============================================================================================================================
;==================================== Maintenance ================================================
;================================================================================================
Function RestoreDefaultFields()
parent.RestoreDefaultFields()
bBalanced = True
bUseShoutCharge = True
ShoutTime = DEFShoutTime
EndFunction
;===============================================================================================================================
;==================================== States ================================================
;================================================================================================
State Equipped
Event OnBeginState()
RegisterForAnimationEvent(SelfRef, BashExit)
EndEvent
Event OnAnimationEvent(ObjectReference akSource, string EventName)
if SelfRef.isSneaking() && TeleportCost()
ThrowVoiceSpell.cast(SelfRef)
endif
EndEvent
Event OnEndState()
UnregisterForAnimationEvent(SelfRef, BashExit)
EndEvent
EndState
;===============================================================================================================================
;==================================== Functions ================================================
;================================================================================================
bool Function TeleportCost()
if bUseShoutCharge
if !SelfRef.GetVoiceRecoveryTime()
SelfRef.SetVoiceRecoveryTime(ShoutTime * SelfRef.GetActorValue("ShoutRecoveryMult"))
return True
else
INEQ__ShoutFail.play(SelfRef)
endif
else
return True
endif
return false
EndFunction
;===============================================================================================================================
;==================================== Menus ================================================
;================================================================================================
Function AbilityMenu(INEQ_MenuButtonConditional Button, INEQ_ListenerMenu ListenerMenu, GlobalVariable MenuActive)
bool abMenu = True
int aiButton
while abMenu && MenuActive.Value
SetButtonMain(Button)
aiButton = MainMenu.Show()
if aiButton == 0
abMenu = False
elseif aiButton == 9 ; Cancel Menu
MenuActive.SetValue(0)
elseif aiButton == 1 ; Turn on Balanced
RestoreDefaultFields()
elseif aiButton == 2 ; Turn off Balanced
bBalanced = False
elseif aiButton == 3 ; Shout cost -> On
bUseShoutCharge = True
elseif aiButton == 4 ; Shout Cost -> Off
bUseShoutCharge = False
elseif aiButton == 5 ; Set Charge Time
ShoutTime = ListenerMenu.ChargeTime(ShoutTime, DEFShoutTime)
endif
endwhile
EndFunction
; Updates the Button to show the correct menu options
Function SetButtonMain(INEQ_MenuButtonConditional Button)
Button.clear()
if bBalanced
Button.set(2)
else
Button.set(1)
if bUseShoutCharge
Button.set(4)
Button.set(5)
else
Button.set(3)
endif
endif
Button.set(9)
EndFunction