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