T_ScNews_Bellman_Paper
Tamriel_Data.esm
Variables
3
Local Variables
OnPCAdd
doOnce
resetDay
Source
1Begin T_ScNews_Bellman_Paper
2
3short OnPCAdd
4short doOnce
5short resetDay
6
7; README
8; this rather opaque script ensures that the game treats papers that were placed by hand in the CS different
9; from papers that were spawned by script from the T_News_Bellman_Spawner_X objects. The way that
10; this is achieved is by using CellChanged - papers placed by hand encounter a CellChanged the first time
11; they are loaded, while papers spawned by the Spawner first appear in the game world *after* CellChanged
12; has been detected, and passed, on the Spawner object. This means that a spawned paper progresses
13; through doOnce==0, ==1 and ==2, while a placed paper is intercepted on the second frame by CellChanged,
14; and has its doOnce variable set to -1.
15
16if ( doOnce == -1 )
17 Return
18endif
19
20if ( CellChanged )
21 if ( doOnce == 2 )
22 ; papers that are at this stage have successfully passed through the setup once,
23 ; without being interrupted by CellChanged. This means that they were spawned
24 ; rather than hand-placed, and as such they get disabled and deleted after two days.
25 if ( resetDay <= DaysPassed )
26 Disable
27 set doOnce to 3
28 endif
29 else
30 ; papers that did not proceed through the entire setup are papers that were hand-placed,
31 ; and here is where CellChanged interrupts the setup and renders them inert.
32 set doOnce to -1
33 endif
34 Return
35endif
36
37if ( OnPCAdd == 1 )
38 ; OnPCAdd renders the script inert, and ensures the paper does not delete itself.
39 set doOnce to -1
40 Return
41endif
42
43if ( doOnce == 0 )
44 set doOnce to 1
45 ; skip a frame to give CellChanged a chance to trigger
46elseif ( doOnce == 1 )
47 if ( GetPos Z == 0 )
48 if ( GetPos Y == 0 )
49 if ( GetPos X == 0 )
50 ; papers without coordinates are in an inventory, and are rendered inert.
51 set doOnce to -1
52 Return
53 endif
54 endif
55 endif
56 if ( doOnce == 1 )
57 ; at this stage, CellChanged has had a chance to trigger - and if it didn't,
58 ; it means that this paper was spawned into the cell after cell change.
59 ; here, we set the reset parameters that ensure the paper deletes itself
60 ; if not picked up within two days.
61 set resetDay to ( 2 + DaysPassed )
62 set doOnce to 2
63 endif
64elseif ( doOnce == 3 )
65 SetDelete 1
66 Return
67endif
68
69End