TR_m2_q_38_s_ghost
TR_Mainland.esm
Variables
1
Local Variables
DoOnce
Source
1begin TR_m2_q_38_s_ghost
2
3 ; attached to the ghost - disables/enables, provides sound effects, removes when dead
4
5 short DoOnce
6
7 if ( DoOnce == 0 )
8 ; disable at the start
9 Disable
10 set DoOnce to 1
11 elseif ( DoOnce == 1 )
12 if ( GetDisabled != 1 )
13 ; we don't enable here, that happens in another script
14 if ( OnDeath == 1 )
15 ; if ghost dies, either via Favryn killing him or via script
16 If ( GetSoundPlaying "Spirit Ambient Voices" == 1 )
17 ; stop the spirit voices sound playing
18 StopSound "Spirit Ambient Voices"
19 endif
20 Disable
21 Set DoOnce to 2
22 return
23 elseif ( GetSoundPlaying "Spirit Ambient Voices" == 0 )
24 ; whispery sound effects
25 PlaySound3D "Spirit Ambient Voices"
26 endif
27 if ( CellChanged )
28 ; contingency if player leaves the temple
29 if ( TR_m2_q_38_sabotage >= 3 )
30 sethealth 0
31 endif
32 endif
33 endif
34 elseif ( DoOnce == 2 )
35 if ( GetDisabled == 1 )
36 ; we can delete the ghost once it's disabled, we won't need it anymore
37 SetDelete 1
38 return
39 endif
40 endif
41end