TR_m7_HH_Dren_q_Orvas2SC
TR_Mainland.esm
Variables
5
Local Variables
PCSkipEquip
OnPCEquip
button
doOnce
letterState
Source
1begin TR_m7_HH_Dren_q_Orvas2SC
2
3short PCSkipEquip
4short OnPCEquip
5short button
6short doOnce
7short letterState
8;global TR_m7_HH_Dren_q_Orvas1_Seal
9;condensed from 2 globals to 1
10;still need a second script as the letters themselves are different
11
12if ( GetDisabled )
13 Return
14endif
15
16if ( doOnce == 0 ) ; init pcskipequip, necessary if added directly to players inventory
17 if ( TR_m7_HH_Dren_q_Orvas1_Seal == 0 )
18 ; if seal is unbroken, avoid equipping
19 set PCSkipEquip to 1
20 else
21 set letterState to 2
22 set PCSkipEquip to 0
23 endif
24 set doOnce to 1
25endif
26
27if ( OnActivate )
28 Player->AddItem "TR_m7_HH_Dren_q_Orvas2" 1
29 Disable
30 MessageBox "You pick up the letter."
31endif
32
33if ( letterState == 2 ) ; letter unsealed
34 Set PCSkipEquip to 0
35endif
36
37if ( OnPCEquip == 0 )
38 Set button to -1
39 Return
40endif
41
42if ( letterState == 0 ) ; sealed letter
43 if ( TR_m7_HH_Dren_q_Orvas1_Seal == 0 )
44 MessageBox "Do you want to break the seal on the letter? It cannot be repaired." "Yes" "No"
45 Set letterState to 1
46 else
47 Set PCSkipEquip to 0
48 Set OnPCEquip to 0
49 endif
50endif
51
52if ( letterState == 1 )
53 set button to GetButtonPressed
54 if ( button == 0 )
55 ;unseal it and set global
56 Set letterState to 2
57 Set TR_m7_HH_Dren_q_Orvas1_Seal to 1
58 Set OnPCEquip to 0
59 Set PCSkipEquip to 0
60 MessageBox "You have broken the seal." "Okay"
61
62 elseif ( button == 1 )
63 Set letterState to 0
64 Set PCSkipEquip to 1
65 Set OnPCEquip to 0
66 ;leave it sealed and reset PCSkipEquip
67 endif
68 Return
69endif
70
71End