Scripts

TR_m1_Q59_MaI_Script_5

TR_Mainland.esm
Variables 11
Local Variables
looking
DoOnce
state
state1
state2
state3
testvar
TR_Map
T_Local_NPC
NoLore
timer
Source
1Begin TR_m1_Q59_MaI_Script_5 2 3;This is the standard "detect script" used in the Redram Oran Investigation 4;quest for Telvanni Guard. 5 6short looking 7short DoOnce 8short state 9short state1 10short state2 11short state3 12short testvar 13short TR_Map 14float timer 15short T_Local_NPC 16short NoLore 17 18If ( MenuMode ) 19 Return 20endif 21 22if ( state3 == -1 ) 23 Return 24endif 25 26if ( TR_Map != 1 ) 27 set TR_Map to 1 28endif 29 30if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 402 ) 31 if ( GetJournalIndex "TR_m1_PT_MaI_4" <= 404 ) 32 SetFight 100 33 SetDisposition 0 34 set state3 to -1 35 endif 36endif 37 38if ( state2 >= 0 ) 39 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 10 ) 40 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 109 ) 41 if ( GetDeadCount "tr_m1_varrac_odrethi" >= 1 ) 42 if ( state2 == 0 ) 43 Journal "TR_m1_PT_MaI_4" 350 44 set state2 to 1 45 elseif ( state2 == 2 ) 46 Journal "TR_m1_PT_MaI_4" 350 47 set state2 to -1 48 endif 49 endif 50 endif 51 endif 52 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 10 ) 53 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 109 ) 54 if ( GetDeadCount "tr_m1_tinera_odrethi" >= 1 ) 55 if ( state2 == 0 ) 56 Journal "TR_m1_PT_MaI_4" 351 57 set state2 to 2 58 elseif ( state2 == 1 ) 59 Journal "TR_m1_PT_MaI_4" 351 60 set state2 to -1 61 endif 62 endif 63 endif 64 endif 65 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 110 ) 66 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 119 ) 67 if ( GetDeadCount "tr_m1_varrac_odrethi" >= 1 ) 68 if ( state2 == 0 ) 69 Journal "TR_m1_PT_MaI_4" 350 70 set state2 to 1 71 elseif ( state2 == 2 ) 72 Journal "TR_m1_PT_MaI_4" 350 73 set state2 to -1 74 endif 75 endif 76 endif 77 endif 78 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 110 ) 79 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 119 ) 80 if ( GetDeadCount "tr_m1_tinera_odrethi" >= 1 ) 81 if ( state2 == 0 ) 82 Journal "TR_m1_PT_MaI_4" 351 83 set state2 to 2 84 elseif ( state2 == 1 ) 85 Journal "TR_m1_PT_MaI_4" 351 86 set state2 to -1 87 endif 88 endif 89 endif 90 endif 91 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 120 ) 92 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 129 ) 93 if ( GetDeadCount "tr_m1_varrac_odrethi" >= 1 ) 94 if ( state2 == 0 ) 95 Journal "TR_m1_PT_MaI_4" 350 96 set state2 to 1 97 elseif ( state2 == 2 ) 98 Journal "TR_m1_PT_MaI_4" 350 99 set state2 to -1 100 endif 101 endif 102 endif 103 endif 104 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 120 ) 105 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 129 ) 106 if ( GetDeadCount "tr_m1_tinera_odrethi" >= 1 ) 107 if ( state2 == 0 ) 108 Journal "TR_m1_PT_MaI_4" 351 109 set state2 to 2 110 elseif ( state2 == 1 ) 111 Journal "TR_m1_PT_MaI_4" 351 112 set state2 to -1 113 endif 114 endif 115 endif 116 endif 117 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 350 ) 118 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 500 ) 119 if ( GetDeadCount "tr_m1_varrac_odrethi" >= 1 ) 120 if ( state2 == 0 ) 121 Journal "TR_m1_PT_MaI_4" 350 122 set state2 to 1 123 elseif ( state2 == 2 ) 124 Journal "TR_m1_PT_MaI_4" 350 125 set state2 to -1 126 endif 127 endif 128 endif 129 endif 130 if ( GetJournalIndex "TR_m1_PT_MaI_4" >= 350 ) 131 if ( GetJournalIndex "TR_m1_PT_MaI_4" < 500 ) 132 if ( GetDeadCount "tr_m1_tinera_odrethi" >= 1 ) 133 if ( state2 == 0 ) 134 Journal "TR_m1_PT_MaI_4" 351 135 set state2 to 2 136 elseif ( state2 == 1 ) 137 Journal "TR_m1_PT_MaI_4" 351 138 set state2 to -1 139 endif 140 endif 141 endif 142 endif 143endif 144 145if ( state1 >= 0 ) 146 if ( GetJournalIndex "TR_m1_PT_MaI_3" > 10 ) 147 if ( GetJournalIndex "TR_m1_PT_MaI_3" < 100 ) 148 if ( GetDeadCount "tr_m1_varrac_odrethi" >= 1 ) 149 if ( state1 == 0 ) 150 Journal "TR_m1_PT_MaI_3" 40 151 set state1 to 1 152 elseif ( state1 == 2 ) 153 Journal "TR_m1_PT_MaI_3" 40 154 set state1 to -1 155 endif 156 endif 157 endif 158 endif 159 if ( GetJournalIndex "TR_m1_PT_MaI_3" > 10 ) 160 if ( GetJournalIndex "TR_m1_PT_MaI_3" < 100 ) 161 if ( GetDeadCount "tr_m1_tinera_odrethi" >= 1 ) 162 if ( state1 == 0 ) 163 Journal "TR_m1_PT_MaI_3" 41 164 set state1 to 2 165 elseif ( state1 == 1 ) 166 Journal "TR_m1_PT_MaI_3" 41 167 set state1 to -1 168 endif 169 endif 170 endif 171 endif 172endif 173 174if ( GetJournalIndex "TR_m1_PT_MaI_3" == 30 ) 175 set timer to ( timer + GetSecondsPassed ) 176 if ( timer > 15 ) 177 set DoOnce to -3 178 ForceGreeting 179 endif 180endif 181 182if ( DoOnce >= -2 ) 183 if ( GetJournalIndex "TR_m1_PT_MaI_3" == 35 ) 184 SetFight 100 185 SetDisposition 0 186 set DoOnce to -3 187 endif 188endif 189 190if ( GetJournalIndex "TR_m1_PT_MaI_3" < 10 ) 191 Return 192elseif ( GetJournalIndex "TR_m1_PT_MaI_3" >= 30 ) 193 Return 194endif 195 196if ( state == 0 ) 197 set State to 1 198 if ( Player->GetInvisible ) 199 ForceGreeting 200 elseif ( Player->GetChameleon >= 85 ) 201 ForceGreeting 202 endif 203endif 204 205set timer to ( timer + GetSecondsPassed ) 206set testvar to ( Player->GetArmorType 5 ) 207 208if ( state == 1 ) 209 if ( timer > 3 ) 210 set state to -1 211 endif 212endif 213 214if ( state == -1 ) 215 if ( GetJournalIndex "TR_m1_PT_MaI_3" < 20 ) 216 if ( GetDistance TR_m1_Varrac_Odrethi > 512 ) 217 if ( GetDistance Player <= 256 ) 218 if ( testvar != -1 ) 219 set DoOnce to -1 220 ForceGreeting 221 elseif ( GetPCSneaking != 1 ) 222 set DoOnce to -1 223 ForceGreeting 224 endif 225 endif 226 endif 227 endif 228endif 229 230if ( timer < 3 ) 231 Return 232endif 233 234set timer to 0 235set looking to 1 236 237if ( Player->GetInvisible ) 238 set looking to 0 239elseif ( Player->GetChameleon >= 85 ) 240 set looking to 0 241elseif ( GetLOS Player == 0 ) 242 set looking to 0 243endif 244 245if ( looking == 1 ) 246 if ( GetDetected Player ) 247 set DoOnce to -2 248 set timer to 0 249 ForceGreeting 250 endif 251endif 252 253end