TR_m4_Ando_FaulerChestScript
TR_Mainland.esm
Variables
6
Local Variables
chestState
containsPotion
detected
activated
journalCheck
doOnce
Source
1Begin TR_m4_Ando_FaulerChestScript
2
3; Script to control the (original) chest in Hemmette Fauler's shop
4
5short chestState
6short containsPotion
7short detected
8short activated
9short journalCheck
10short doOnce
11
12if ( TR_m4_Ando_NevusaPotionPlaced == 1 )
13 if ( MenuMode == 0 )
14 if ( TR_m4_Ando_HemmettePrison > 0 )
15 Set TR_m4_Ando_NevusaPotionPlaced to 0
16 if ( GetItemCount "TR_m4_And_NevusaPotion" > 0 )
17 RemoveItem "TR_m4_And_NevusaPotion" 1
18 endif
19 elseif ( GetJournalIndex "TR_m4_And_Alchemists_3" >= 10 )
20 Set TR_m4_Ando_NevusaPotionPlaced to 0
21 if ( GetItemCount "TR_m4_And_NevusaPotion" > 0 )
22 RemoveItem "TR_m4_And_NevusaPotion" 1
23 endif
24 endif
25 endif
26endif
27
28if ( GetJournalIndex "TR_m4_And_Alchemists_3" >= 140 ) ; upgrades chest
29 if ( doOnce == 0 )
30 AddItem "p_restore_health_e" 3
31 AddItem "p_restore_fatigue_e" 2
32 AddItem "p_restore_magicka_e" 2
33 Set doOnce to 1
34 endif
35endif
36
37if ( journalCheck != 0 )
38 Set journalCheck to 0
39endif
40if ( GetJournalIndex "TR_m4_And_Alchemists_1" >= 20 )
41 if ( GetJournalIndex "TR_m4_And_Alchemists_3" < 10 )
42 if ( GetJournalIndex "TR_m4_And_Alchemists_1" < 50 )
43 if ( GetJournalIndex "TR_m4_And_Alchemists_2" < 50 )
44 if ( GetJournalIndex "TR_m4_And_Alchemists_6" < 25 )
45 if ( TR_m4_Ando_NevusaDead == 0 )
46 Set journalCheck to 1
47 endif
48 endif
49 endif
50 endif
51 endif
52endif
53
54if ( journalCheck == 0 ) ; behaves like a normal chest outside of quest
55 if ( OnActivate )
56 Activate
57 endif
58 return
59elseif ( GetLocked == 1 )
60 if ( OnActivate )
61 Activate
62 endif
63 return
64endif
65
66if ( chestState == 1 )
67 ; check if the spoiled potion is in the chest
68 if ( GetItemCount "TR_m4_And_NevusaPotion" > 0 )
69 Set containsPotion to 1
70 if ( GetJournalIndex "TR_m4_And_Alchemists_1" < 40 )
71 Journal "TR_m4_And_Alchemists_1" 40
72 endif
73 else
74 Set containsPotion to 0
75 endif
76
77 Set TR_m4_Ando_NevusaPotionPlaced to containsPotion
78endif
79
80if ( MenuMode )
81 return
82endif
83
84if ( activated == 1 ) ; wait one frame to make sure detection is carried out
85 Set activated to 0
86 if ( detected == 0 )
87 Activate
88 if ( chestState == 0 )
89 Set chestState to 1
90 endif
91 endif
92 Set detected to 0
93 return
94endif
95
96if ( OnActivate )
97 Set activated to 1
98 if ( GetDetected Player )
99 Set TR_m4_Hemmette_Fauler.controlQ to 1
100 TR_m4_Hemmette_Fauler->ForceGreeting
101 Set detected to 1
102 endif
103endif
104
105End