TR_m4_q_TTSCorane_scrpt
TR_Mainland.esm
Variables
17
Local Variables
TR_Map
control
control1
control2
controlQ
nolore
DoOnce
DoOnce2
State
State2
DeathCheck
LocalDaysPassed
CurrentDay
ItemCheck
T_Local_NPC
T_Local_NoLore
GameHourCheck
Source
1Begin TR_m4_q_TTSCorane_scrpt
2
3short TR_Map
4short control
5short control1
6short control2
7short controlQ
8short nolore
9short DoOnce
10short DoOnce2
11short State
12short State2
13short DeathCheck
14short LocalDaysPassed
15short CurrentDay
16short ItemCheck
17float GameHourCheck
18short T_Local_NPC
19short T_Local_NoLore
20
21if ( MenuMode )
22 return
23endif
24
25if ( TR_Map != 4 )
26 set TR_Map to 4
27endif
28
29if ( Control == 0 ) ;These locals decide if you pickpocketed the amulet or not, most stuff is handled by dialogue
30 if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 10 )
31 set ControlQ to 10
32 set Control to 1
33 endif
34elseif ( Control == 2 )
35 if ( GetJournalIndex "TR_m4_wil_TribunalTS" > 50 )
36 set ControlQ to 30
37 set Control to 3
38 endif
39endif
40
41if ( control1 == 0 )
42 if ( GetTarget Player == 1 )
43 set control1 to 1
44 endif
45endif
46
47set ItemCheck to ( GetItemCount "TR_m4_q_TTSAncestral_Amulet" )
48
49if ( State2 == 0 )
50 if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 35 )
51 Set State to 0
52 Set State2 to 1
53 return
54 elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" > 35 )
55 Set State2 to 1
56 return
57 endif
58 Set State to 5
59endif
60
61
62if ( GetPos X < 150 ) ;Dialogue related, urges you to go inside the locked door.
63 if ( GetPos Y > 1100 )
64 Set control2 to 10
65 endif
66endif
67
68
69if ( DoOnce == 0 ) ;Makes Corane travel to the last pathgrid near the amulet
70 if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 20 )
71 if ( GetDistance "TR_m4_q_TTSAncestral_ScrptAmule" < 550 )
72 if ( GetPos Z < - 175 )
73 AItravel -257.000 618.000 -256.000 1
74 setHello 0
75 set DoOnce to 1
76 endif
77 endif
78 endif
79endif
80
81if ( DoOnce == 1 ) ;has the effect of adding the amulet to Corane
82 if ( GetAIPackageDone == 1 )
83 if ( GetPos Z < - 175 )
84 if ( GetPos Z > - 275 )
85 if ( GetJournalIndex "TR_m4_wil_TribunalTS" != 35 )
86 TR_m4_q_TTSAncestral_ScrptAmule->disable
87 additem TR_m4_q_TTSAncestral_Amulet 1
88 Journal TR_m4_wil_TribunalTS 30
89 AIFollow player 0 0 0 0
90 setHello 1
91 set DoOnce to 2
92 else
93 AIFollow player 0 0 0 0
94 set DoOnce to 2
95 endif
96 endif
97 endif
98 endif
99endif
100
101if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 10 ) ;Keeps track of days passed when you accept the quest but don't go in.
102 if ( currentDay != Day )
103 set currentDay to Day
104 set LocalDaysPassed to LocalDaysPassed + 1
105 endif
106elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" == 17 )
107 if ( currentDay != Day )
108 set currentDay to Day
109 set LocalDaysPassed to LocalDaysPassed + 1
110 endif
111endif
112
113if ( DoOnce2 != 10 ) ;Forcegreetings for corane
114 if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 25 )
115 forcegreeting
116 set state to 10
117 elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" == 10 ) ;When you don't go in for 2 days
118 if ( GetCurrentAIPackage == 3 )
119 if ( LocalDaysPassed >= 3 )
120 forcegreeting
121 set DoOnce2 to 10
122 endif
123 endif
124 elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" == 17 )
125 if ( GetCurrentAIPackage == 3 )
126 if ( LocalDaysPassed >= 3 )
127 forcegreeting
128 set DoOnce2 to 10
129 endif
130 endif
131 elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" >= 98 ) ;After the quest gets over manually
132 if ( GetJournalIndex "TR_m4_wil_TribunalTS" <= 120 )
133 if ( GetCurrentAIPackage == 3 )
134 if ( GetDistance TR_m4_q_Gilmaso_Olthan > 500 )
135 if ( GetWeaponDrawn == 0 )
136 forcegreeting
137 return
138 set DoOnce2 to 10
139 endif
140 endif
141 endif
142 endif
143 endif
144endif
145
146
147if ( DoOnce != 10 ) ;Fixes a bug where sometimes Corane doesn't follow you after you kill the ghost
148 if ( GetJournalIndex "TR_m4_wil_TribunalTS" == 83 )
149 if ( GetCurrentAIPAckage != 3 )
150 AIFollow Player 0 0 0 0
151 Set DoOnce to 10
152 endif
153 endif
154endif
155
156
157if ( DeathCheck != 0 ) ;Death check
158 return
159elseif ( GetJournalIndex TR_m4_wil_TribunalTS < 10 )
160 return
161elseif ( OnDeath )
162 journal TR_m4_wil_TribunalTS 22
163 set TR_m4_q_TTSCoraneDead to 1
164 set DeathCheck to 1
165endif
166
167if ( control1 == 0 )
168 if ( TR_m4_q_TTSFranDead ) ;If Francessa dies, Corane will attack you
169 if ( TR_m4_q_TTSCombatState == 0 )
170 SetFight 100
171 StartCombat Player
172 set control1 to 1
173 endif
174 endif
175endif
176
177if ( GetJournalIndex "TR_m4_wil_TribunalTS" < 98 )
178 if ( GetJournalIndex "TR_m4_wil_TribunalTS" != 27 )
179 if ( GetJournalIndex "TR_m4_wil_TribunalTS" != 18 )
180 return
181 endif
182 endif
183elseif ( GetJournalIndex "TR_m4_wil_TribunalTS" >= 130 )
184 return
185elseif ( GetDisabled )
186 return
187elseif ( CellChanged )
188 if ( GetInterior )
189 Disable
190 return
191 else
192 ;do not disable when crossing exterior cell borders
193 set GameHourCheck to ( ( GameHour - GameHourCheck ) * 30 / TimeScale )
194 if ( GameHourCheck < 0 )
195 set GameHourCheck to ( -1 * GameHourCheck )
196 endif
197 if ( GameHourCheck < 0.01 )
198 if ( GetDistance, player < 6500 )
199 return
200 endif
201 endif
202 Disable
203 endif
204endif
205set GameHourCheck to GameHour
206
207End