TR_m4_AndoHH_SujammaCrate
TR_Mainland.esm
Variables
6
Local Variables
eggcount
oldcount
diff
temp
doOnce
frameCount
Source
1Begin TR_m4_AndoHH_SujammaCrate
2
3; Checks if player has found the Sujamma and emptied the crate.
4; Also controls the egg counter in the room
5
6short eggcount
7short oldcount ; number of eggs in previous frame
8short diff
9short temp
10short doOnce
11short frameCount
12
13Set eggcount to ( Player->GetItemCount "TR_m4_AndoHH_RottenEgg" )
14
15if ( CellChanged )
16 Set temp to TR_m4_AndoHH_EggStorage
17 Set oldcount to eggcount ; update when entering room
18 Set frameCount to 0
19 if ( TR_m4_AndoHH_EggStorage > 0 )
20 MessageBox "A foul smell of rotten eggs fills the room."
21 endif
22endif
23
24if ( eggcount != oldcount ) ; eggs picked up / dropped
25 Set diff to ( eggcount - oldcount )
26 Set temp to ( temp - diff )
27endif
28
29if ( temp != TR_m4_AndoHH_EggStorage )
30 Set frameCount to ( frameCount + 1 )
31 if ( frameCount > 5 ) ; skip a few frames to check that cell has not just updated
32 Set TR_m4_AndoHH_EggStorage to temp
33 Set frameCount to 0
34 endif
35endif
36
37Set oldcount to eggcount
38
39if ( OnActivate )
40 Activate
41 if ( GetJournalIndex "TR_m4_HH_AND_Crates" > 0 )
42 if ( TR_m4_AndoHH_SujammaCheck == 0 )
43 Set TR_m4_AndoHH_SujammaCheck to 1
44 endif
45 endif
46endif
47
48if ( GetJournalIndex "TR_m4_HH_AND_Crates" == 100 )
49 if ( doOnce == 0 )
50 while ( GetItemCount "potion_local_liquor_01" > 0 )
51 RemoveItem "potion_local_liquor_01" 1
52 endwhile
53 Set doOnce to 1
54 endif
55 return
56endif
57
58if ( GetJournalIndex "TR_m4_HH_AND_Crates" > 0 )
59 if ( TR_m4_AndoHH_SujammaCheck < 2 )
60 if ( GetItemCount "potion_local_liquor_01" == 0 )
61 Set TR_m4_AndoHH_NalvynaReward to ( TR_m4_AndoHH_NalvynaReward + 50 ) ; increase quest reward
62 Set TR_m4_AndoHH_SujammaCheck to 2
63 endif
64 elseif ( GetItemCount "potion_local_liquor_01" > 0 ) ; so you can't just put it back
65 Set TR_m4_AndoHH_NalvynaReward to ( TR_m4_AndoHH_NalvynaReward - 50 )
66 Set TR_m4_AndoHH_SujammaCheck to 1
67 endif
68endif
69
70End