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