TR_m4_Ando_DispCasVendi_sc
TR_Mainland.esm
Variables
2
Local Variables
state
timer
Source
1Begin TR_m4_Ando_DispCasVendi_sc
2
3; Unique script for a display case locked by the TR_m4_Key_VermiVendicciManor key
4; (remember to change the MessageBox alongside the key ID!).
5; Created because a generic base script version in Tamriel_Data (T_ScObj_DisplayCaseImp1)
6; overrides the locked/trapped container behavior. Locked behavior is simulated here,
7; while the traps just have to be omitted from containers using these display case scripts.
8
9float timer
10; a variable to prevent the door from frequently getting opened and closed
11short state
12; 0 = initial state
13; 1 = opening
14; 2 = open
15; 3 = closing
16; 4 = closed
17
18if ( MenuMode == 1 )
19 return
20endif
21
22if ( onActivate == 1 )
23 if ( getLocked > 0 )
24 if ( player->GetItemCount, "TR_m4_Key_VermiVendicciManor" < 1 )
25 if ( timer >= 1 )
26 set timer to 0
27 endif
28 playSound3D "LockedChest"
29 else
30 unlock
31 set state to 1
32 set timer to 0
33 playSound3DVP "Door Creaky Open" 0.5 1
34 MessageBox "Vermilius Vendicci's Manor Key used to open lock"
35 endif
36 elseif ( state > 2 )
37 if ( timer >= 1 )
38 set state to 1
39 set timer to 0
40 playSound3DVP "Door Creaky Open" 0.5 1
41 endif
42 elseif ( state < 3 )
43 if ( timer >= 1 )
44 set state to 3
45 set timer to 0
46 playSound3DVP "Door Creaky Close" 0.5 1
47 endif
48 endif
49endif
50
51if ( timer < 1 )
52 set timer to ( timer + getSecondsPassed )
53endif
54
55if ( state == 0 ); set the lid to closed
56 set state to 4
57 set timer to 1
58endif
59
60if ( state == 1 ); the lid is opening
61 playGroup idle2 0
62 set state to 2
63 return
64endif
65
66if ( state == 2 ); the lid has finished opening
67 playGroup idle4 0
68 return
69endif
70
71if ( state == 3 ); the lid is closing
72 playGroup idle3 0
73 set state to 4
74 return
75endif
76
77if ( state == 4 ); the lid has finished closing
78 playGroup idle 0
79endif
80
81End