TR_m4_AndoHH_SealedLetter_sc
TR_Mainland.esm
Variables
7
Local Variables
sealFailed
PCSkipEquip
OnPCEquip
scrollState
securityCheck
button
wasActivated
Source
1begin TR_m4_AndoHH_SealedLetter_sc
2
3; script for handling sealed letters during the "A New Employment" quest. Replicates Vanilla behavior.
4
5short sealFailed
6short PCSkipEquip
7short OnPCEquip
8short scrollState
9short securityCheck
10short button
11short wasActivated
12
13;scrollState...
14;0 never been loaded, sets PCSkipEquip once
15;1 scoll is sealed, ask if you want to unseal
16;2 player has been asked to unseal, wait for response
17;3 it is unsealed and can be read
18;4 it has been read once, ask if you want to re-seal
19;5 player has been asked to re-seal, wait for response
20
21if ( GetDisabled == 1 )
22 Return
23endif
24
25if ( scrollState == 0 )
26 ;set up PCSkipEquip for first use
27 Set PCSkipEquip to 1
28 Set scrollState to 1
29endif
30
31if ( OnActivate == 1 )
32 Set wasActivated to 1
33 ;handle activate method of reading books
34endif
35
36if ( wasActivated == 1 )
37 set wasActivated to 0
38 if ( scrollState == 1 )
39 MessageBox "This scroll has been sealed. If you want to break the seal, drop the scroll on your character." "Okay." "Pick up Scroll."
40 set scrollState to 10
41 Return
42 endif
43
44 if ( scrollState == 10 )
45 set button to GetButtonPressed
46 if ( button == 0 )
47 Set scrollState to 0
48 Set wasActivated to 0
49 elseif ( button == 1 )
50 ;can't get around activate... so we add another copy to the player and disable this reference
51 if ( TR_m4_AndoHH_LetterID == 0 )
52 Player->AddItem "TR_m4_AndoHH_SealedLetter" 1
53 elseif ( TR_m4_AndoHH_LetterID == 1 )
54 Player->AddItem "TR_m4_AndoHH_SealedReply" 1
55 elseif ( TR_m4_AndoHH_LetterID == 2 )
56 Player->AddItem "TR_m4_AndoHH_SealedReply_m" 1
57 ;else
58 ;Player->AddItem "TR_m4_AndoHH_SealedReply_f" 1
59 endif
60 Set scrollState to 0
61 Set wasActivated to 0
62 Disable
63 endif
64 Return
65 endif
66
67 Activate
68endif
69
70
71if ( OnPCEquip == 0 )
72 Set button to -1
73 Return
74endif
75
76if ( scrollState == 1 )
77 MessageBox "Do you want to break the seal and read the scroll?" "Yes" "No"
78 Set scrollState to 2
79endif
80
81if ( scrollState == 2 )
82 set button to GetButtonPressed
83 if ( button == 0 )
84 Set scrollState to 3
85 Set TR_m4_AndoHH_UnsealLetter to ( TR_m4_AndoHH_UnsealLetter + 1 )
86 Set OnPCEquip to 0
87 Set PCSkipEquip to 0
88 MessageBox "You have broken the seal." "Okay"
89 ;unseal it and set global
90 elseif ( button == 1 )
91 Set scrollState to 1
92 Set PCSkipEquip to 1
93 Set OnPCEquip to 0
94 ;leave it sealed and reset PCSkipEquip
95 endif
96 Return
97endif
98
99if ( scrollState == 3 )
100 Set scrollState to 4
101 Set PCSkipEquip to 1
102 Return
103endif
104
105if ( scrollState == 4 )
106 MessageBox "Do you want to read the scroll again, or try to re-seal the scroll?" "Read again" "Re-seal it"
107 Set scrollState to 5
108 Return
109endif
110
111if ( scrollState == 5 )
112 set button to GetButtonPressed
113 if ( button == 0 )
114 Set scrollState to 3
115 Set OnPCEquip to 0
116 Set PCSkipEquip to 0
117 elseif ( button == 1 )
118 if ( sealFailed == 0 )
119 Set securityCheck to Random 100
120 if ( Player->GetSecurity > securityCheck )
121 Set scrollState to 1
122 Set PCSkipEquip to 1
123 Set TR_m4_AndoHH_UnsealLetter to ( TR_m4_AndoHH_UnsealLetter - 1 )
124 MessageBox "You have resealed the scroll." "Okay"
125 ;reset state and conditions here
126 else
127 set sealFailed to 1
128 MessageBox "You have damaged the seal." "Okay"
129 endif
130 else
131 MessageBox "The seal has been damaged." "Okay"
132 endif
133 Set OnPCEquip to 0
134 endif
135endif
136
137
138End