Scripts

TR_m1_q_Guard_HuntScript

TR_Mainland.esm
Variables 13
Local Variables
TR_Map
control
NoLore
doonce
arrest
escape
state
speakonce
myposition
T_Local_NPC
T_Local_NoLore
x1
y1
Source
1Begin TR_m1_q_Guard_HuntScript 2 3; Script on NPC TR_m1_q_Guard_Hunt. 4 5short TR_Map 6short control 7short NoLore 8short doonce 9short arrest ; 0 == not arrested, 1 == decide where arrested, 2 == arrested 10short escape 11short state ; 1 == left passage, 2 == pit passage, 3 == right passage, 4 == main passage, 5 == small room 12short speakonce 13short myposition ; 1 == left passage, 2 == pit passage, 3 == right passage, 4 == main passage, 5 == small room 14 15If ( MenuMode ) 16 return 17Endif 18 19If ( arrest == 0 ) 20 set doonce to 0 21Endif 22 23If ( control == 1 ) 24 If ( CellChanged ) 25 set control to 0 26 PositionCell 1622 5114 11685 2760 Palisnabat ;TR_m1_MARK_PalisnabatGuard 27 AiWander 0 0 0 0 0 0 0 0 0 0 0 0 28 setfight 30 29 Endif 30 return 31Endif 32 33If ( arrest == 0 ) 34 If ( GetDistance, Player <= 400 ) 35 ForceGreeting 36 Endif 37Endif 38 39; Below block tells script in which part of cave PC was arrested 40 41float x1 42float y1 43short T_Local_NPC 44short T_Local_NoLore 45set x1 to ( player->GetPos X ) 46set y1 to ( player->GetPos Y ) 47 48If ( arrest == 1 ) 49 If ( y1 <= 4870 ) 50 If ( x1 >= 4470 ) 51 If ( doonce == 0 ) 52 set state to 5 53 set doonce to 1 54 Endif 55 Endif 56 Endif 57 If ( y1 <= 4900 ) 58 If ( x1 >= 2200 ) 59 If ( doonce == 0 ) 60 set state to 1 61 set doonce to 1 62 Endif 63 Endif 64 Endif 65 If ( y1 <= 5370 ) 66 If ( x1 <= 2200 ) 67 If ( doonce == 0 ) 68 set state to 2 69 set doonce to 1 70 Endif 71 Endif 72 Endif 73 If ( y1 >= 5370 ) 74 If ( x1 <= 2700 ) 75 If ( doonce == 0 ) 76 set state to 3 77 set doonce to 1 78 Endif 79 Endif 80 Endif 81 If ( y1 >= 4870 ) 82 If ( x1 >= 2700 ) 83 If ( doonce == 0 ) 84 set state to 4 85 set doonce to 1 86 Endif 87 Endif 88 Endif 89 set arrest to 2 90Endif 91 92; Below block tells script in which part of cave PC is whilst arrested. If he goes too far, arrest the player. 93 94If ( arrest == 2 ) 95 If ( y1 <= 4870 ) 96 If ( x1 >= 4470 ) 97 set myposition to 5 98 Endif 99 Endif 100Endif 101If ( y1 <= 4900 ) 102 If ( x1 >= 2200 ) 103 set myposition to 1 104 Endif 105Endif 106If ( y1 <= 5370 ) 107 If ( x1 <= 2200 ) 108 set myposition to 2 109 Endif 110Endif 111If ( y1 >= 5370 ) 112 If ( x1 <= 2700 ) 113 set myposition to 3 114 Endif 115Endif 116If ( y1 >= 4870 ) 117 If ( x1 >= 2700 ) 118 set myposition to 4 119 Endif 120Endif 121 122If ( arrest == 2 ) 123 If ( myposition != state ) 124 If ( myposition != 4 ) 125 If ( speakOnce == 0 ) 126 set speakOnce to 1 127 set escape to 1 128 ForceGreeting 129 Endif 130 Endif 131 Endif 132Endif 133 134if ( TR_Map == 1 ) 135 return 136endif 137 138set TR_Map to 1 139 140End