TR_m7_NPC_Alvon_Releth
TR_Mainland.esm
Variables
13
Local Variables
TR_Map
control
controlQ
controlA
NoLore
T_Local_NPC
T_Local_NoLore
doonce
doonce1
doonce2
state
timer
posx
Source
1Begin TR_m7_NPC_Alvon_Releth
2
3short TR_Map
4short control ; used for dialogue
5short controlQ ; used to control explosion sequence timing
6short controlA ; used to control when explosion sequence starts
7short NoLore
8short T_Local_NPC
9short T_Local_NoLore
10short doonce ; used to control half health explosion so it only happens once
11short doonce1 ; used to make sure storm atronach's are only summoned once
12short doonce2
13short state ; variable used for state of fight
14float timer ; timer for various actions
15float posx ; gets player position to remove barrier if necessary
16
17if ( MenuMode )
18 return
19endif
20
21if ( state == 5 )
22 return
23endif
24
25if ( OnDeath ) ; if the PC kills Alvon the barrier needs to go down if it's not already somehow, state 5 shorts the script
26 set state to 5
27 if ( "TR_m7_NS_ShockTherapy_Barrier"->getdisabled == 0 )
28 "TR_m7_NS_ShockTherapy_Barrier"->disable
29 endif
30 return
31endif
32
33if ( state > 0 ) ; if the player DI's or AI's and then returns to Sarahu this will reset the fight
34 if ( cellchanged )
35 if ( doonce == 2 )
36 removespell "TR_m7_AlvonsNova"
37 set doonce to 0
38 elseif ( doonce == 1 )
39 set doonce to 0
40 endif
41 set state to 0
42 stopcombat
43 positioncell 4232 3465 14539 12000 "Sarahu" ; returns to original position
44 aiwander 0 0 0 30 20 10
45 setfight 80
46 "TR_m7_NS_ShockTherapy_Barrier"->disable
47 return
48 endif
49endif
50
51if ( state == 3 ) ; fight happens mainly in state 3
52 set posx to ( player->getpos x )
53 if ( posx < 3440 ) ; this disables the barrier if the PC manages to levitate or jump out of the arena - lets Alvon pursue them and prevents jank
54 "TR_m7_NS_ShockTherapy_Barrier"->disable
55 endif
56 if ( doonce == 0 ) ; this sequence runs ONCE at 50% health on Alvon
57 if ( gethealth < 250 )
58 set ControlA to 1
59 set doonce to 1
60 return
61 endif
62 elseif ( doonce == 1 )
63 if ( gethealth < 100 )
64 addspell "TR_m7_AlvonsNova"
65 set doonce to 2
66 endif
67 endif
68 if ( ControlA == 1 )
69 cast "TR_m7_AlvonsSWeakness" player ; this is meant to up the stakes for dodging lighting after 50% - really hard to dodge this 100% shock weakness spell
70 set ControlA to 2
71 elseif ( ControlA == 2 )
72 set timer to ( timer + getsecondspassed ) ; lets ALSO add a strong barrier for the rest of the fight, makes up a bit for his lack of armor
73 if ( timer > 1.5 )
74 addspell "TR_m7_AlvonsBarrier"
75 set timer to 0
76 set ControlA to 0
77 return
78 endif
79 endif
80 return
81endif
82
83if ( state == 2 )
84 set timer to ( timer + getsecondspassed )
85 if ( timer > 1.3 ) ; Only does this for the initial start of combat - summons two atronachs timed with the shockbloom cast
86 if ( doonce1 == 0 )
87 placeatme "atronach_storm" 1 100 2
88 placeatme "atronach_storm" 1 100 3
89 placeatme "T_Glb_Var_SummonFX" 1 100 2
90 placeatme "T_Glb_Var_SummonFX" 1 100 3
91 set doonce1 to 1
92 endif
93 "TR_m7_NS_ShockTherapy_Barrier"->enable ; enables his barrier timed with shockbloom cast to prevent PC from running and using AI pathing to cheese the fight
94 set state to 3
95 set timer to 0
96 endif
97endif
98
99if ( state == 1 ) ; initial cast of a souped up shockbloom that lasts longer and tacks on shock weakness
100 cast "TR_M7_AlvonsShockbloom" player
101 set state to 2
102endif
103
104if ( state == 0 ) ; initial sequence to start the fight - Alvon will accuse the PC of attempting to steal his notes
105 if ( getdistance player <= 650 ) ; sequence doesn't start until PC close to Alvon
106 if ( GetLOS Player == 1 ) ; Alvon needs LoS so this doesn't start in the area below
107 if ( getdetected player == 1 ) ; If the PC is invisible or successfully sneaking then don't forcegreet
108 setfight 100
109 startcombat player
110 set state to 1
111 forcegreeting
112 return
113 endif
114 endif
115 endif
116endif
117
118set TR_Map to 7
119
120End