TR_m2_q_12_Rianele
TR_Mainland.esm
Variables
12
Local Variables
TR_map
control
controlQ
NoLore
rianvar
riangreeting
hitplayer
OnPCHitMe
doonce
T_Local_NPC
T_Local_NoLore
Timer
Source
1Begin TR_m2_q_12_Rianele
2;q2-12_Misc - Which Witch? - Local Script, used for the various functions of this quest regarding Rianele
3Short TR_map
4Short control
5Short controlQ
6Short NoLore
7Short rianvar
8Float Timer
9Short riangreeting
10Short hitplayer ; To check if the player even helped with killing Rianele
11Short OnPCHitMe
12Short doonce
13short T_Local_NPC
14short T_Local_NoLore
15
16if ( TR_Map != 2 )
17 set TR_Map to 2
18endif
19
20if ( MenuMode == 1 )
21 return
22endif
23
24;We only want to check GetDistance once per second because it's quite slow.
25;To do this we'll create a timer to count the seconds.
26;It stops working once she has greeted the player (rianvar=2)
27
28if ( rianvar < 2 )
29 Set Timer to ( Timer + GetSecondsPassed )
30endif
31
32;Every timer our timer has counted a second, we check how far away the player is.
33;Initially (rianvar=0) we just want to check if the player is close enough to start the quest
34;but after that (rianvar=1) we want to check if she's close enough to greet the player
35
36if ( Timer > 1 )
37 Set Timer to 0
38 if ( rianvar == 0 )
39 if ( GetDistance, player < 4000 ) ;change these distances to whatever seems good
40 Set rianvar to 1
41 endif
42 elseif ( rianvar == 1 )
43 if ( GetDistance, player < 500 )
44 Set rianvar to 2
45 endif
46 endif
47endif
48
49
50;This block handles her movement.
51;When quest is activated (rianvar=1), she runs towards the player.
52;We could remove the GetForceRun and GetCurrentAIPackage checks, but
53;they prevent any bugs if she stops running for any reason.
54;When she is close enought to greet the player (rianvar=2), we stop
55;the running and make her greet the player.
56
57if ( rianvar == 1 )
58 if ( GetForceRun == 0 )
59 ForceRun
60 endif
61 if ( GetCurrentAIPackage != 3 )
62 AIFollow, Player, 0,0,0,0
63 endif
64endif
65if ( rianvar == 2 )
66 Set rianvar to 3
67 ClearForceRun
68 AIWander 0,0,20,0,0,60,0,0
69 ForceGreeting
70 return
71endif
72
73if ( riangreeting == 1 )
74 ForceGreeting
75 return
76endif
77
78if ( OnPCHitMe == 1 )
79 set hitplayer to 1
80endif
81
82if ( TR_m2_q_12_Alfhed->OnDeath == 1 )
83set controlQ to 1
84StopCombat
85 if ( TR_m2_q_12_Alfhed.HasAxe == 1 )
86 Journal, "TR_m2_Wil_WhichWitch", 80
87 endif
88endif
89
90if ( TR_m2_q_12_Alfhed.controlQ == 2 )
91 if ( doonce == 0 )
92 StopCombat
93 set controlQ to 1
94 set doonce to 1
95 endif
96endif
97
98if ( CellChanged == 1 )
99 if ( controlQ == 1 )
100 disable
101 TR_m2_q_12_Alfhed->disable
102 endif
103endif
104
105if ( OnDeath == 1 )
106 ; First, check if Alfhed is also dead
107 if ( GetDeadCount "TR_m2_q_12_Alfhed" >= 1 )
108 Journal "TR_m2_wil_WhichWitch" 90
109 else
110 ; Alfhed is not dead, proceed with original logic for Rianeles death
111 if ( GetJournalIndex "TR_m2_Wil_WhichWitch" == 5 )
112 if ( hitplayer == 1 )
113 set TR_m2_q_12_Alfhed.controlQ to 1
114 Journal "TR_m2_Wil_WhichWitch" 15
115 else
116 set TR_m2_q_12_Alfhed.controlQ to 3
117 Journal "TR_m2_Wil_WhichWitch" 60
118 endif
119 endif
120 endif
121endif
122
123end