TR_m7_Ns_HH_SarithaLetter_sc
TR_Mainland.esm
Variables
7
Local Variables
sealFailed
PCSkipEquip
OnPCEquip
scrollState
securityCheck
button
wasActivated
Source
1Begin TR_m7_Ns_HH_SarithaLetter_sc
2
3; script for handling sealed letters during the "House Hlaalu Angry Letter" 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 Player->AddItem "TR_m7_Ns_HH_SarithaLetter" 1
52 Set scrollState to 0
53 Set wasActivated to 0
54 Disable
55 endif
56 Return
57 endif
58
59 Activate
60endif
61
62
63if ( OnPCEquip == 0 )
64 Set button to -1
65 Return
66endif
67
68if ( scrollState == 1 )
69 MessageBox "Do you want to break the seal and read the scroll?" "Yes" "No"
70 Set scrollState to 2
71endif
72
73if ( scrollState == 2 )
74 set button to GetButtonPressed
75 if ( button == 0 )
76 Set scrollState to 3
77 Set TR_m7_Ns_HH_SarithaSeal to ( TR_m7_Ns_HH_SarithaSeal + 1 )
78 Set OnPCEquip to 0
79 Set PCSkipEquip to 0
80 MessageBox "You have broken the seal." "Okay"
81 ;unseal it and set global
82 elseif ( button == 1 )
83 Set scrollState to 1
84 Set PCSkipEquip to 1
85 Set OnPCEquip to 0
86 ;leave it sealed and reset PCSkipEquip
87 endif
88 Return
89endif
90
91if ( scrollState == 3 )
92 Set scrollState to 4
93 Set PCSkipEquip to 1
94 Return
95endif
96
97if ( scrollState == 4 )
98 MessageBox "Do you want to read the scroll again, or try to re-seal the scroll?" "Read again" "Re-seal it"
99 Set scrollState to 5
100 Return
101endif
102
103if ( scrollState == 5 )
104 set button to GetButtonPressed
105 if ( button == 0 )
106 Set scrollState to 3
107 Set OnPCEquip to 0
108 Set PCSkipEquip to 0
109 elseif ( button == 1 )
110 if ( sealFailed == 0 )
111 Set securityCheck to Random 100
112 if ( Player->GetSecurity > securityCheck )
113 Set scrollState to 1
114 Set PCSkipEquip to 1
115 Set TR_m7_Ns_HH_SarithaSeal to ( TR_m7_Ns_HH_SarithaSeal - 1 )
116 MessageBox "You have resealed the scroll." "Okay"
117 ;reset state and conditions here
118 else
119 set sealFailed to 1
120 MessageBox "You have damaged the seal." "Okay"
121 endif
122 else
123 MessageBox "The seal has been damaged." "Okay"
124 endif
125 Set OnPCEquip to 0
126 endif
127endif
128
129
130End