TR_m4_TT_Nalvs_Andolin_sc
TR_Mainland.esm
Variables
12
Local Variables
TR_Map
control
controlQ
NoLore
T_Local_NPC
moneyExpected
moneySet
moneySatisfied
T_Local_NoLore
noHit
ThankIbelard
timer
Source
1Begin TR_m4_TT_Nalvs_Andolin_sc
2
3; Script on NPC TR_m4_TT_Nalvs_Andolin, the main questgiver
4; of the Bal Foyen Temple questline. This relates to various quests.
5
6short TR_Map
7short control
8short controlQ
9short NoLore
10short T_Local_NPC
11short moneyExpected
12short moneySet
13short moneySatisfied
14float timer
15short T_Local_NoLore
16short noHit
17short ThankIbelard ; for "Remnants of Resdayn"
18
19if ( moneySet == 1 )
20 ; Figure out how much money to expect the player to donate.
21 ; This is for quest TR_m4_TT_Forgiveness.
22 set moneySet to ( player->GetItemCount gold_001 )
23 set moneySet to ( moneySet / 10 )
24 if ( moneyExpected < moneySet )
25 set moneyExpected to moneySet
26 endif
27 set moneySet to 0
28endif
29
30if ( controlQ == 0 )
31 ; Find out what the player has done in the Armun Ashlands.
32 ; This is for quest TR_m4_TT_ArmunAdventure.
33 if ( GetJournalIndex TR_m4_TT_ArmunAdventure_b >= 100 )
34 if ( GetDeadCount "TR_m4_Ulmon Vathri" == 0 )
35 set controlQ to 1
36 else ; if player killed Ulmon, the questline ends here.
37 set controlQ to -1
38 endif
39 elseif ( GetJournalIndex TR_m4_TT_ArmunAdventure_c >= 100 )
40 if ( GetDeadCount "TR_m4_Ulmon Vathri" == 0 )
41 set controlQ to 1
42 else
43 set controlQ to -1
44 endif
45 elseif ( GetJournalIndex TR_m4_TT_ArmunAdventure_d >= 100 )
46 if ( GetDeadCount "TR_m4_Ulmon Vathri" == 0 )
47 set controlQ to 1
48 else
49 set controlQ to -1
50 endif
51 elseif ( GetJournalIndex TR_m4_TT_ArmunAdventure_e >= 90 )
52 if ( GetDeadCount "TR_m4_Ulmon Vathri" == 0 )
53 set controlQ to 1
54 else
55 set controlQ to -1
56 endif
57 elseif ( GetJournalIndex TR_m4_TT_ArmunAdventure_f >= 100 )
58 if ( GetDeadCount "TR_m4_Ulmon Vathri" == 0 )
59 set controlQ to 1
60 else
61 set controlQ to -1
62 endif
63 endif
64endif
65
66if ( controlQ == 1 )
67 set controlQ to 2
68 PositionCell 4669 4483 14753 11500 "Bal Foyen, Temple"
69 AIWander 0 0 5 20 20 20 0 10 10 20 0
70; AITravel 4160 4200 14020
71 "TR_m4_Ulmon Vathri"->Disable
72; TR_m4_TT_Ulmon_Dead->Enable
73 TR_m4_TT_Ravur_Othravel->PositionCell 4360, 4500, 14020, 12500, "Bal Foyen, Temple"
74 TR_m4_TT_Ravur_Othravel->AIWander 0, 0, 0, 0, 40, 0, 10, 0, 5, 5, 25, 5
75 TR_m4_TT_Ravur_Othravel->SetHello 0
76elseif ( controlQ == 2 )
77 if ( GetDistance player < 150 )
78 set controlQ to 3
79 ForceGreeting
80 elseif ( player->GetPos Z < 14700 )
81 ; makes no sense, but the dialogue triggers important scripts
82 ; and needs to fire before the player descends the stairs.
83 ; only relevant if the player recalls into the Temple below.
84 set controlQ to 3
85 ForceGreeting
86 endif
87elseif ( controlQ == 10 )
88 ; Nalvs is escorting the player to the tomb.
89 if ( GetAIPackageDone )
90 set controlQ to 11
91 AIWander 0 0 5 20 20 20 0 10 10 20 0
92 if ( GetDeadCount TR_m4_TT_Ravur_Othravel == 0 )
93 set TR_m4_TT_Ravur_Othravel.controlQ to 21
94 endif
95 endif
96elseif ( controlQ == 11 )
97 if ( GetJournalIndex TR_m4_TT_LastWillAndTestament >= 45 )
98 if ( CellChanged )
99 ; Nalvs flees to Omaynis:
100 set controlQ to 12
101 TR_m4_TT_Ravur_Othravel->PositionCell 3940 4349 14753 15000 "Bal Foyen, Temple"
102 TR_m4_TT_Ravur_Othravel->AIWander 0, 0, 5, 0, 40, 0, 10, 0, 5, 5, 25, 5
103 set TR_m4_TT_Ravur_Othravel.controlQ to 31
104 RemoveItem common_robe_02_h 1
105 AddItem TR_m4_TT_FelaniLetter2 1
106 PositionCell 4645 3825 15504 16200 "Omaynis, Ulmon Vathri's House"
107 AIWander 0 0 5 20 20 20 0 10 10 20 0
108 set T_Local_NoLore to 0
109 endif
110 endif
111elseif ( controlQ == 12 )
112 if ( GetPCCell "Omaynis, Ulmon Vathri's House" != 0 )
113 if ( TR_m4_TT_DepartDay < ( DaysPassed - 1 ) )
114 set controlQ to 100
115 set noHit to 0 ; go quietly now, my sweet prince
116 SetHealth 0
117 TR_m4_TT_Ravur_Othravel->PositionCell 4737 3807 15491 0 "Omaynis, Ulmon Vathri's House"
118 TR_m4_TT_Ravur_Othravel->AIWander 0, 0, 5, 0, 40, 0, 10, 0, 5, 5, 25, 5
119 set TR_m4_TT_Ravur_Othravel.controlQ to 34
120 Journal TR_m4_TT_LastWillAndTestament_b 66
121 Return
122 elseif ( GetDistance player < 300 )
123 Journal TR_m4_TT_LastWillAndTestament_b 65
124 set controlQ to 13
125 endif
126 endif
127elseif ( controlQ == 20 )
128 ; Ravur has called on Nalvs to surrender.
129 if ( MenuMode == 0 )
130 set controlQ to 21
131 ForceGreeting
132 endif
133elseif ( controlQ == 22 )
134 ; Nalvs has started combat.
135 if ( OnDeath )
136 if ( GetDeadCount TR_m4_TT_Ravur_Othravel > 0 )
137 Journal TR_m4_TT_LastWillAndTestament 200
138 else
139 Journal TR_m4_TT_LastWillAndTestament_b 75
140 endif
141 endif
142endif
143
144if ( control == 0 )
145 if ( GetJournalIndex TR_m4_TT_AndothrenCharity >= 100 ) ; reset Ravur to start if quest is done
146 set control to 1
147 set TR_m4_TT_Ravur_Othravel.controlQ to 20
148 if ( player->GetDistance TR_m4_TT_Ravur_Othravel < 100000 ) ; in same cell
149 TR_m4_TT_Ravur_Othravel->AITravel 3940 4349 14753
150 else
151 TR_m4_TT_Ravur_Othravel->PositionCell 3940 4349 14753 15000 "Bal Foyen, Temple"
152 TR_m4_TT_Ravur_Othravel->AIWander 0, 0, 5, 0, 40, 0, 10, 0, 5, 5, 25, 5
153 endif
154 endif
155endif
156
157if ( TR_Map == 4 )
158 return
159endif
160
161set TR_Map to 4
162set T_Local_NoLore to 1 ; no nolore at the start
163set noHit to 1 ; no noHit at start
164
165End