TR_m3_q_AT_recipe_script
TR_Mainland.esm
Variables
5
Local Variables
PCSkipEquip
OnPCEquip
scrollState
button
securityCheck
Source
1Begin TR_m3_q_AT_recipe_script
2
3short PCSkipEquip
4short OnPCEquip
5short scrollState
6short button
7short securityCheck
8;global TR_m3_q_AT_recipe_sealed
9;0 sealed
10;1 unsealed
11;2 broken by pc
12;3 broken by ordinator
13
14if ( GetDisabled == 1 )
15 Return
16endif
17
18if ( scrollState == 0 )
19 set PCSkipEquip to 1
20 set scrollState to 1
21endif
22
23if ( OnActivate == 1 )
24 PlaySound "book open"
25 player->AddItem "TR_m3_q_AT_Recipe" 1
26 Disable
27 Return
28endif
29
30if ( TR_m3_q_AT_recipe_sealed > 1 )
31 if ( PCSkipEquip == 1 )
32 set PCSkipEquip to 0
33 endif
34 if ( OnPCEquip == 1 )
35 set OnPCEquip to 0
36 endif
37 Return
38endif
39
40if ( OnPCEquip == 0 )
41 set button to -1
42 Return
43endif
44
45if ( TR_m3_q_AT_recipe_sealed == 0 )
46 if ( scrollState == 1 )
47 MessageBox "Do you want to break the seal and read the scroll?" "Yes" "No"
48 set scrollState to 2
49 else
50 set button to GetButtonPressed
51 if ( button == 0 )
52 set OnPCEquip to 0
53 set PCSkipEquip to 0
54 MessageBox "You have broken the seal." "Okay"
55 set TR_m3_q_AT_recipe_sealed to 1
56 elseif ( button == 1 )
57 set PCSkipEquip to 1
58 ;leave it sealed and reset PCSkipEquip
59 else
60 Return
61 endif
62 set OnPCEquip to 0
63 set scrollState to 1
64 endif
65elseif ( TR_m3_q_AT_recipe_sealed == 1 )
66 if ( scrollState == 1 )
67 MessageBox "Do you want to read the scroll again, or try to re-seal the scroll?" "Read again" "Re-seal it"
68 set scrollState to 2
69 else
70 set button to GetButtonPressed
71 if ( button == 0 )
72 set OnPCEquip to 0
73 set PCSkipEquip to 0
74 elseif ( button == 1 )
75 set securityCheck to Random 100
76 if ( player->GetSecurity > securityCheck )
77 set TR_m3_q_AT_recipe_sealed to 0
78 set PCSkipEquip to 1
79 MessageBox "You have resealed the scroll." "Okay"
80 else
81 set TR_m3_q_AT_recipe_sealed to 2
82 MessageBox "You have damaged the seal." "Okay"
83 endif
84 else
85 Return
86 endif
87 set scrollState to 1
88 set OnPCEquip to 0
89 endif
90endif
91
92end