TR_m4_TJ_Bonelord_Judge_sc
TR_Mainland.esm
Variables
6
Local Variables
OnPCHitMe
greet
abort
state
blockframetimer
secretdoor
Source
1Begin TR_m4_TJ_Bonelord_Judge_sc
2
3short OnPCHitMe
4short greet
5short abort
6short state
7short blockframetimer
8short secretdoor
9;global TR_m4_TJ_Court_State
10
11if ( OnDeath )
12 set abort to 2
13 set TR_m4_TJ_Court_State to 11
14 AddItem T_EnSc_Com_TenthBarrier 1
15 AddItem T_EnSc_Com_TwinHours 2
16 AddItem sc_bodily_restoration 1
17 Return
18endif
19
20if ( abort == 1 )
21 set abort to 2
22 SetFight 100
23 StartCombat player
24 set TR_m4_TJ_Court_State to 10
25 set TR_m4_TJ_Scamp_Accused.state to 99
26 Return
27elseif ( abort > 1 )
28 Return
29endif
30
31if ( MenuMode )
32 Return
33endif
34
35if ( OnPCHitMe )
36 set abort to 1
37 Return
38endif
39
40if ( GetTarget player )
41 set abort to 1
42 Return
43endif
44
45if ( greet == 1 )
46 set greet to 2
47 ForceGreeting
48endif
49
50if ( secretdoor == 1 )
51 if ( state < 100 )
52 set secretdoor to 2
53 set abort to 1
54 ForceGreeting
55 Return
56 endif
57endif
58
59if ( state == 77 )
60 set abort to 1
61 ForceGreeting
62 Return
63endif
64
65; if player changes cell while trial is ongoing, disruptive
66if ( CellChanged )
67 if ( state >= 2 )
68 if ( state < 90 )
69 set state to 90
70 endif
71 endif
72endif
73
74if ( state == 0 )
75 if ( blockframetimer < 5 )
76 set blockframetimer to ( blockframetimer + 1 ) ; more reliable way of blocking the cellchange getpos issue
77 elseif ( player -> GetPos Y > 3600 )
78 set state to 1
79 set greet to 1
80 Return
81 endif
82elseif ( state == 90 )
83 ; player approaches after telling they'd leave
84 if ( player -> GetPos Y > 3700 )
85 ; attack
86 set state to 91
87 set abort to 1
88 ForceGreeting
89 Return
90 endif
91endif
92
93End