TR_m2_q_12_AlfhedScript
TR_Mainland.esm
Variables
11
Local Variables
TR_map
control
controlQ
alfvar
alfgreeting
doonce
HasAxe
T_Local_NPC
nolore
state_check
Timer
Source
1begin TR_m2_q_12_AlfhedScript
2;q2-12_Misc - Which Witch? - Local script, placed on TR_m2_q_12_Alfhed
3;Keeps track of the force greetings to open the quest, and if Alfhed gets calmed, fights, etc.
4Short TR_map
5Short control
6Short controlQ
7Short alfvar
8Short alfgreeting
9Short doonce
10Short HasAxe
11Float Timer
12short T_Local_NPC
13short nolore
14short state_check
15
16if ( TR_Map != 2 )
17 set TR_Map to 2
18endif
19
20if ( MenuMode == 1 )
21 return
22endif
23
24if ( alfvar == 0 )
25 if ( GetJournalIndex "TR_m2_wil_WhichWitch" == 5 )
26 StartCombat, "TR_m2_q_12_Rianele_Sele"
27 Set alfvar to 1
28 elseif ( GetJournalIndex "TR_m2_wil_WhichWitch" < 5 )
29 if ( GetCurrentAIPackage != 3 )
30 ForceRun
31 AIFollow, "TR_m2_q_12_Rianele_Sele", 0,0,0,0
32 endif
33 endif
34elseif ( alfvar == 1 )
35 if ( OnKnockout )
36 StopCombat
37 Journal "TR_m2_wil_WhichWitch" 20
38 Set alfvar to 2
39 Set controlQ to 2
40 endif
41 if ( GetEffect sEffectCalmHumanoid == 1 )
42 StopCombat
43 Journal "TR_m2_wil_WhichWitch" 20
44 Set alfvar to 2
45 Set controlQ to 2
46 endif
47elseif ( alfvar == 2 )
48 if ( GetFatigue < 25 )
49 StopCombat
50 endif
51endif
52
53if ( controlQ > 0 ) ; To ensure that Alfhed stops combat after quest begins.
54 if ( doonce == 0 )
55 StopCombat
56 set doonce to 1
57 endif
58endif
59
60if ( alfgreeting == 1 )
61 Set Timer to ( Timer + GetSecondsPassed )
62 if ( Timer >= .5 ) ; to avoid an issue with the forcegreetings
63 set timer to 0
64 set alfgreeting to 2
65 if ( alfgreeting == 2 )
66 ForceGreeting
67 return
68 endif
69 endif
70endif
71
72if ( CellChanged == 1 )
73 if ( GetWeaponDrawn == 0 )
74 if ( controlQ >= 3 )
75 disable
76 TR_m2_q_12_Rianele_Sele->Disable
77 endif
78 endif
79endif
80
81if ( GetJournalIndex "TR_m2_wil_WhichWitch" < 90 ) ; Only run if quest stage is not already 90 or higher
82 if ( GetDeadCount "TR_m2_q_12_Alfhed" > 0 )
83 if ( GetDeadCount "TR_m2_q_12_Rianele_Sele" > 0 )
84 Journal "TR_m2_wil_WhichWitch" 90
85 endif
86 endif
87endif
88
89end