TR_m4_Bal_NPC_HannatTulu_Sc
TR_Mainland.esm
Variables
22
Local Variables
nolore
TR_Map
T_Local_Vampire
control
controlQ
NoHello
NoFlee
NoIdle
NoIntruder
NoThief
T_Local_NPC
T_Local_NoLore
checkBlood
doOnce
state
ashStorm
fixHead
TR_m4_Bal_ClanMember
greeting
forcegreetOnce
chameleonDisable
timer
Source
1begin TR_m4_Bal_NPC_HannatTulu_Sc
2
3; Baluath Questline
4; Script running on Hannat-Tulu.
5
6; PROVINCE LOCAL VARIABLES HERE
7short nolore
8short TR_Map
9short T_Local_Vampire
10short control
11short controlQ
12
13short NoHello
14short NoFlee
15short NoIdle
16short NoIntruder
17short NoThief
18short T_Local_NPC
19short T_Local_NoLore
20
21short checkBlood
22short doOnce
23short state
24
25;Vanilla global PCVampire
26;Vanilla global PCWerewolf
27;Tamriel_Data global T_Glob_PorphyricInfected
28
29;Baluath ash storm benefits variables
30float timer
31short ashStorm
32short fixHead
33
34; Hannat-Tulu
35short TR_m4_Bal_ClanMember
36short greeting
37short forcegreetOnce
38short chameleonDisable
39
40;------------------------------------------------
41; Hannat-Tulu quest-specific behavior
42;------------------------------------------------
43
44if ( GetJournalIndex TR_m4_Bal_Hannat < 10 )
45 ; disable before the quest
46 if ( GetDisabled == 0 )
47 disable
48 endif
49elseif ( GetJournalIndex TR_m4_Bal_Hannat < 100 )
50
51 ; enable at night and during ash storm, disable otherwise
52 if ( GameHour < 6 )
53 if ( chameleonDisable )
54 set chameleonDisable to 0
55 endif
56 elseif ( GameHour >= 20 )
57 if ( chameleonDisable )
58 set chameleonDisable to 0
59 endif
60 elseif ( GetWindSpeed == 0 )
61 if ( chameleonDisable == 0 )
62 set chameleonDisable to 1
63 endif
64 elseif ( ashStorm == 1 )
65 if ( chameleonDisable )
66 set chameleonDisable to 0
67 endif
68 elseif ( chameleonDisable == 0 )
69 set chameleonDisable to 1
70 endif
71
72 ; disable while sleeping, disable with chameleon or enable (not during the fight) based on conditions
73 ; otherwise, he'll die from sun damage
74 if ( GetPCSleep )
75 if ( GetDisabled == 0 )
76 disable
77 endif
78 elseif ( chameleonDisable )
79 if ( GetDisabled == 0 )
80 ModChameleon 1
81 if ( GetChameleon >= 100 )
82 setchameleon 0
83 disable
84 endif
85 endif
86 elseif ( GetDisabled )
87 if ( TR_m4_Bal_DevourerSpawned == 0 )
88 setchameleon 0
89 enable
90 elseif ( TR_m4_Bal_DevourerDead )
91 setchameleon 0
92 enable
93 endif
94 endif
95
96elseif ( GetDisabled )
97 setchameleon 0
98 enable
99endif
100
101;-----------------------------------------------
102; Drop vampire dust on death like vanilla
103;-----------------------------------------------
104
105if ( OnDeath )
106 AddItem "ingred_vampire_dust_01" 1
107
108 if ( GetJournalIndex TR_m4_Bal_Hannat >= 10 )
109 if ( GetJournalIndex TR_m4_Bal_Hannat < 100 )
110 Journal TR_m4_Bal_Hannat 200
111 endif
112 endif
113
114 ; Hannat-Tulu
115 if ( TR_m4_Bal_ClanMember == 1 )
116 set TR_m4_baluathdead to ( TR_m4_baluathdead + 1 )
117 endif
118endif
119
120;-----------------------------------------------
121; Check player infection/vampire status
122;-----------------------------------------------
123
124if ( CellChanged )
125 set checkBlood to 0
126 set state to 0
127
128 if ( T_Glob_PorphyricInfected )
129 elseif ( player->GetSpell "Vampire Blood Quarra" )
130 elseif ( player->GetSpell "Vampire Blood Aundae" )
131 elseif ( player->GetSpell "Vampire Blood Berne" )
132 elseif ( PCVampire != 0 )
133 elseif ( PCWerewolf == 1 )
134 else
135 ;Player isn't infected/vampire/cured vampire/werewolf
136 set checkBlood to 1
137 endif
138endif
139
140if ( fixHead )
141 ;Mod-added heads disappear when the Vampirism effect is removed/swapped
142 ;To fix this we equip a helmet and remove it to reset the head model
143 set fixHead to 0
144 equip T_Glb_Var_HeadFixer ;Lack of AddItem is intentional
145 RemoveItem T_Glb_Var_HeadFixer 1
146endif
147
148if ( MenuMode )
149 return
150endif
151
152;Baluath stuff, see cure script
153set timer to ( timer + GetSecondsPassed )
154if ( timer > 1 )
155 set timer to 0
156 if ( ashStorm )
157 set ashStorm to 0
158 endif
159 if ( GetWindSpeed )
160 if ( GetCurrentWeather >= 6 ) ;ash
161 if ( GetCurrentWeather <= 7 ) ;blight
162 set ashStorm to 1
163 endif
164 endif
165 endif
166 if ( ashStorm )
167 if ( GetSpell "T_Vamp_Ab_Baluath_Ash" == 0 )
168 AddSpell "T_Vamp_Ab_Baluath_Ash"
169 AddSpell "T_Vamp_Sp_Baluath_Ash"
170 AddSpell "T_Vamp_Ab_Baluath_SunDmg"
171 RemoveSpell "vampire sun damage"
172 set fixHead to 1
173 endif
174 elseif ( GetSpell "T_Vamp_Ab_Baluath_Ash" )
175 RemoveSpell "T_Vamp_Ab_Baluath_Ash"
176 RemoveSpell "T_Vamp_Sp_Baluath_Ash"
177 AddSpell "vampire sun damage"
178 RemoveSpell "T_Vamp_Ab_Baluath_SunDmg"
179 set fixHead to 1
180 endif
181endif
182
183
184;------------------------------------------------
185; Player was not infected before changing cell,
186; so constantly check for infection and then run
187; this clan's specific global script
188;------------------------------------------------
189
190if ( checkBlood )
191 if ( player->GetSpellEffects "T_Vamp_Dis_Baluath" )
192 if ( ScriptRunning "T_ScVamp_Baluath_PC" != 1 )
193 StartScript "T_ScVamp_Baluath_PC"
194 endif
195 endif
196
197;------------------------------------------------
198; Player was infected/vampire before changing cell,
199; so check whether player is in an enemy clan
200;------------------------------------------------
201
202elseif ( state != 1 )
203 if ( VampClan == 100 )
204 SetFight 30 ;Player is a friendly vampire
205 else
206 SetFight 90 ;Player is an enemy vampire
207 endif
208
209 set state to 1
210endif
211
212;------------------------------------------------
213; Apply vampire spells/abilities to this NPC once
214;------------------------------------------------
215
216if ( doOnce == 0 )
217 AddSpell "T_Vamp_Dis_Baluath"
218 AddSpell "T_Vamp_Ab_Baluath"
219 AddSpell "Vampire Attributes"
220 AddSpell "Vampire Skills"
221 AddSpell "Vampire Immunities"
222 AddSpell "vampire sun damage"
223 AddSpell "Vampire Touch"
224 ;set province-specific location variable for dialogue here
225 set TR_Map to 4
226 set doOnce to 1
227
228 ; Hannat-Tulu
229 ModRestoration 44 ; down from 75 to train Hand-to-Hand
230endif
231
232;------------------------------------------------
233; Hannat-Tulu quest-specific behavior
234;------------------------------------------------
235
236if ( TR_m4_Bal_DevourerSpawned )
237 if ( TR_m4_Bal_DevourerDead == 0 )
238 return
239 endif
240endif
241
242if ( GetJournalIndex "TR_m4_Bal_Hannat" >= 10 )
243 if ( GetJournalIndex "TR_m4_Bal_Hannat" < 100 )
244 if ( chameleonDisable == 0 )
245 if ( forcegreetOnce == 0 )
246 if ( GetDistance player < 256 )
247 set forcegreetOnce to 1
248 forcegreeting
249 endif
250 endif
251 endif
252 endif
253endif
254
255end