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