Scripts

TR_m2_q_A9_1_SathysN_scr

TR_Mainland.esm
Variables 7
Local Variables
BooksOnPlayer
Sold
Check
IndrysMoved
TR_Map
T_Local_NPC
NoLore
Source
1begin TR_m2_q_A9_1_SathysN_scr 2 3short BooksOnPlayer ; this counts how many Temple books the player carries 4short Sold ; set to 1 when the player sells the books to either Sathys or Indrys, then keep at 1 5short Check ; set to 1 when the script is to compute BooksOnPlayer, then set back to 0 (so as not to do the potentially heavy computation every frame) 6short IndrysMoved ; set to 1 when Indrys is moved into the house 7short TR_Map 8short T_Local_NPC 9short NoLore 10 11; count the number of Temple books the player carries 12 13if ( onDeath ) 14 journal "TR_m2_wil_Farm" 125 15endif 16 17if ( TR_Map != 2 ) 18 set TR_Map to 2 19endif 20 21if ( getJournalIndex TR_m2_wil_Farm == 1 ) 22 set Check to 1 23 if ( IndrysMoved == 0 ) 24 "TR_m2_Indrys Norvayn"->PositionCell 148 310 -108 0 "Acre of Saint Meris" ;TR_m2_MARK_Indrys 25 "TR_m2_Indrys Norvayn"->AiWander 0 0 0 0 0 0 0 0 0 0 0 0 26 set IndrysMoved to 1 27 endif 28endif 29 30; the following if-loop counts how many Temple books the player carries. 31if ( Check == 1 ) 32 set BooksOnPlayer to 0 33 ; the following is a list of Temple books that count in this quest. 34 ; feel free to include more books in the list, but don't forget to also 35 ; include them in the second list further below. 36 if ( Player->getitemcount "bk_LivesOfTheSaints" > 0 ) 37 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 38 endif 39 if ( Player->getitemcount "bk_Anticipations" > 0 ) 40 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 41 endif 42 if ( Player->getitemcount "bk_ConsolationsOfPrayer" > 0 ) 43 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 44 endif 45 if ( Player->getitemcount "bk_CantatasOfVivec" > 0 ) 46 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 47 endif 48 if ( Player->getitemcount "bk_PilgrimsPath" > 0 ) 49 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 50 endif 51 if ( Player->getitemcount "bk_SaryonisSermons" > 0 ) 52 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 53 endif 54 if ( Player->getitemcount "bk_HouseOfTroubles_c" > 0 ) 55 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 56 endif 57 if ( Player->getitemcount "bk_HomiliesOfBlessedAlmalexia" > 0 ) 58 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 59 endif 60 if ( Player->getitemcount "T_Bk_GospelOfSaintLlothisTR" > 0 ) 61 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 62 endif 63 if ( Player->getitemcount "T_Bk_GospelOfSaintAralorTR" > 0 ) 64 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 65 endif 66 if ( Player->getitemcount "T_Bk_GospelOfSaintDelynTR" > 0 ) 67 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 68 endif 69 if ( Player->getitemcount "T_Bk_GospelOfSaintFelmsTR" > 0 ) 70 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 71 endif 72 if ( Player->getitemcount "T_Bk_GospelOfSaintMerisTR" > 0 ) 73 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 74 endif 75 if ( Player->getitemcount "T_Bk_GospelOfSaintNerevarTR" > 0 ) 76 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 77 endif 78 if ( Player->getitemcount "T_Bk_GospelOfSaintOlmsTR" > 0 ) 79 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 80 endif 81 if ( Player->getitemcount "T_Bk_GospelOfSaintRorisTR" > 0 ) 82 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 83 endif 84 if ( Player->getitemcount "T_Bk_GospelOfSaintSerynTR" > 0 ) 85 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 86 endif 87 if ( Player->getitemcount "T_Bk_SermonOfTheSaintsTR" > 0 ) 88 set BooksOnPlayer to ( BooksOnPlayer + 1 ) 89 endif 90 if ( getdeadcount "TR_m2_Indrys Norvayn" == 0 ) 91 if ( BooksOnPlayer >= 3 ) 92 set "TR_m2_Indrys Norvayn".EnoughBooks to 1 93 else 94 set "TR_m2_Indrys Norvayn".EnoughBooks to 0 95 endif 96 endif 97 set Check to 0 98endif 99 100; if the player has enough books, update the journal. 101if ( BooksOnPlayer >= 3 ) 102 if ( getJournalIndex TR_m2_wil_Farm < 20 ) 103 Journal TR_m2_wil_Farm 20 104 endif 105endif 106 107; the following stuff removes 3 books from the player when he sells them. 108; note that the variable BooksOnPlayer has a different role inside this if-loop 109; than it has outside it. 110 111if ( getJournalIndex "TR_m2_wil_Farm" != 30 ) 112 if ( getJournalIndex "TR_m2_wil_Farm" != 65 ) 113 return 114 endif 115endif 116 117if ( Sold == 1 ) 118 return 119endif 120 121set BooksOnPlayer to 3 122; the following is, again, a list of the Temple books the player carries. 123; each time it finds a book on the player, it removes one copy of it and continues 124; with the next book. and so on, until all three are taken. 125; if you want to include any rare or expensive books here (or even skill books), 126; add them at the end, so that they don't get taken if the player has any less 127; valuable alternative. 128if ( Player->getitemcount "bk_LivesOfTheSaints" > 0 ) 129 Player->removeitem "bk_LivesOfTheSaints" 1 130 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 131 if ( BooksOnPlayer <= 0 ) 132 set Sold to 1 133 return 134 endif 135endif 136if ( Player->getitemcount "bk_Anticipations" > 0 ) 137 Player->removeitem "bk_Anticipations" 1 138 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 139 if ( BooksOnPlayer <= 0 ) 140 set Sold to 1 141 return 142 endif 143endif 144if ( Player->getitemcount "bk_ConsolationsOfPrayer" > 0 ) 145 Player->removeitem "bk_ConsolationsOfPrayer" 1 146 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 147 if ( BooksOnPlayer <= 0 ) 148 set Sold to 1 149 return 150 endif 151endif 152if ( Player->getitemcount "bk_CantatasOfVivec" > 0 ) 153 Player->removeitem "bk_CantatasOfVivec" 1 154 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 155 if ( BooksOnPlayer <= 0 ) 156 set Sold to 1 157 return 158 endif 159endif 160if ( Player->getitemcount "bk_PilgrimsPath" > 0 ) 161 Player->removeitem "bk_PilgrimsPath" 1 162 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 163 if ( BooksOnPlayer <= 0 ) 164 set Sold to 1 165 return 166 endif 167endif 168if ( Player->getitemcount "bk_SaryonisSermons" > 0 ) 169 Player->removeitem "bk_SaryonisSermons" 1 170 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 171 if ( BooksOnPlayer <= 0 ) 172 set Sold to 1 173 return 174 endif 175endif 176if ( Player->getitemcount "bk_HouseOfTroubles_c" > 0 ) 177 Player->removeitem "bk_HouseOfTroubles_c" 1 178 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 179 if ( BooksOnPlayer <= 0 ) 180 set Sold to 1 181 return 182 endif 183endif 184if ( Player->getitemcount "bk_HomiliesOfBlessedAlmalexia" > 0 ) 185 Player->removeitem "bk_HomiliesOfBlessedAlmalexia" 1 186 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 187 if ( BooksOnPlayer <= 0 ) 188 set Sold to 1 189 return 190 endif 191endif 192if ( Player->getitemcount "T_Bk_GospelOfSaintLlothisTR" > 0 ) 193 Player->removeitem "T_Bk_GospelOfSaintLlothisTR" 1 194 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 195 if ( BooksOnPlayer <= 0 ) 196 set Sold to 1 197 return 198 endif 199endif 200if ( Player->getitemcount "T_Bk_GospelOfSaintAralorTR" > 0 ) 201 Player->removeitem "T_Bk_GospelOfSaintAralorTR" 1 202 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 203 if ( BooksOnPlayer <= 0 ) 204 set Sold to 1 205 return 206 endif 207endif 208if ( Player->getitemcount "T_Bk_GospelOfSaintDelynTR" > 0 ) 209 Player->removeitem "T_Bk_GospelOfSaintDelynTR" 1 210 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 211 if ( BooksOnPlayer <= 0 ) 212 set Sold to 1 213 return 214 endif 215endif 216if ( Player->getitemcount "T_Bk_GospelOfSaintFelmsTR" > 0 ) 217 Player->removeitem "T_Bk_GospelOfSaintFelmsTR" 1 218 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 219 if ( BooksOnPlayer <= 0 ) 220 set Sold to 1 221 return 222 endif 223endif 224if ( Player->getitemcount "T_Bk_GospelOfSaintMerisTR" > 0 ) 225 Player->removeitem "T_Bk_GospelOfSaintMerisTR" 1 226 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 227 if ( BooksOnPlayer <= 0 ) 228 set Sold to 1 229 return 230 endif 231endif 232if ( Player->getitemcount "T_Bk_GospelOfSaintNerevarTR" > 0 ) 233 Player->removeitem "T_Bk_GospelOfSaintNerevarTR" 1 234 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 235 if ( BooksOnPlayer <= 0 ) 236 set Sold to 1 237 return 238 endif 239endif 240if ( Player->getitemcount "T_Bk_GospelOfSaintOlmsTR" > 0 ) 241 Player->removeitem "T_Bk_GospelOfSaintOlmsTR" 1 242 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 243 if ( BooksOnPlayer <= 0 ) 244 set Sold to 1 245 return 246 endif 247endif 248if ( Player->getitemcount "T_Bk_GospelOfSaintRorisTR" > 0 ) 249 Player->removeitem "T_Bk_GospelOfSaintRorisTR" 1 250 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 251 if ( BooksOnPlayer <= 0 ) 252 set Sold to 1 253 return 254 endif 255endif 256if ( Player->getitemcount "T_Bk_GospelOfSaintSerynTR" > 0 ) 257 Player->removeitem "T_Bk_GospelOfSaintSerynTR" 1 258 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 259 if ( BooksOnPlayer <= 0 ) 260 set Sold to 1 261 return 262 endif 263endif 264if ( Player->getitemcount "T_Bk_SermonOfTheSaintsTR" > 0 ) 265 Player->removeitem "T_Bk_SermonOfTheSaintsTR" 1 266 set BooksOnPlayer to ( BooksOnPlayer - 1 ) 267 if ( BooksOnPlayer <= 0 ) 268 set Sold to 1 269 return 270 endif 271endif 272set Sold to 1 273 274end