TR_m3_q_4_SmugglerScript
TR_Mainland.esm
Variables
9
Local Variables
TR_Map
control
NoLore
state
counter
PCwasAway
T_Local_NPC
T_Local_NoLore
DistanceGet
Source
1Begin TR_m3_q_4_SmugglerScript
2
3;First smuggler in the mine, forcegreets or attacks when PC gets in range
4;Update global when killed
5
6short TR_Map
7short control
8short NoLore
9
10short state
11short counter
12float DistanceGet
13short PCwasAway
14short T_Local_NPC
15short T_Local_NoLore
16
17if ( MenuMode == 1 )
18 Return
19endif
20
21if ( GetJournalIndex "TR_m3_Bo_Kiseen" == 30 ) ;indicates that the player left and re-entered the cell after convincing the smuggler
22 if ( CellChanged == 1 )
23 set PCwasAway to 1
24 endif
25elseif ( GetJournalIndex "TR_m3_Bo_Kiseen" == 40 )
26 if ( CellChanged == 1 )
27 set PCwasAway to 1
28 endif
29endif
30
31if ( OnDeath == 1 )
32 set TR_m3_q_4_dead to ( TR_m3_q_4_dead + 1 )
33 if ( GetJournalIndex "TR_m3_Bo_Kiseen" == 30 )
34 if ( PCwasAway == 0 ) ;having convinced him won't complete the quest if he's killed right afterwards
35 Journal "TR_m3_Bo_Kiseen" 45 ;unless player left the cell and returned,
36 endif ;player will have to kill the others too
37 elseif ( GetJournalIndex "TR_m3_Bo_Kiseen" == 40 )
38 if ( PCwasAway == 0 )
39 Journal "TR_m3_Bo_Kiseen" 45
40 endif
41 endif
42 if ( TR_m3_q_4_dead == 5 )
43 if ( GetJournalIndex "TR_m3_Bo_Kiseen" >= 10 )
44 Journal "TR_m3_Bo_Kiseen" 20
45 endif
46 endif
47endif
48
49if ( Player->GetInvisible == 1 ) ;no forcegreet detection on invisible PC
50 return
51endif
52
53if ( state == 3 ) ;no forcegreets if in combat
54 return
55elseif ( GetAttacked == 1 )
56 TR_m3_O_Kijaar->SetFight, 90
57 set state to 3
58 return
59elseif ( player->GetPos Y <= 3800 ) ;in case invisible PC sneaked behind him
60 if ( counter < 5 ) ;wrong pos is returned when entering the cell, need to wait
61 set counter to ( counter + 1 )
62 else
63 SetFight, 90
64 TR_m3_O_Kijaar->SetFight, 90
65 set state to 3
66 return
67 endif
68else ;attack when close
69 set counter to 0
70 set DistanceGet to ( GetDistance, Player )
71 if ( DistanceGet <= 140 )
72 if ( state <= 2 )
73 set state to 3
74 TR_m3_O_Kijaar->SetFight, 90
75 SetFight 90
76 StartCombat, Player
77 endif
78 elseif ( DistanceGet <= 180 ) ;last warning
79 if ( state <= 1 )
80 if ( state == 1 )
81 set state to 2
82 else
83 set state to 1 ;don't give second greet if the first was skipped by invisibility...
84 endif
85 ForceGreeting
86 set state to 2 ;...no second forcegreet in that case
87 Return
88 endif
89 elseif ( DistanceGet <= 800 ) ;initial greeting
90 if ( state == 0 )
91 Face, 4400, 4300
92 set state to 1
93 ForceGreeting
94 Return
95 endif
96 endif
97endif
98
99if ( TR_Map == 3 )
100 return
101endif
102
103set TR_Map to 3
104
105End