Zitat
begin plx_Sound_Plants
short RandNum
float timer
if ( MenuMode == 1 )
return
endif
if ( GetCurrentWeather > 1 )
return
endif
if ( Gamehour > 16 )
return
endif
if ( Gamehour < 7 )
return
endif
Set timer to ( timer + GetSecondsPassed )
if ( timer < 9 )
Return
endif
Set timer to 0
;STOP ANY SOUNDS ALREADY PLAYING
if ( GetSoundPlaying "plx_ES_plants1" == 1 )
StopSound "plx_ES_plants1"
elseif ( GetSoundPlaying "plx_ES_plants2" == 1 )
StopSound "plx_ES_plants2"
elseif ( GetSoundPlaying "plx_ES_plants3" == 1 )
StopSound "plx_ES_plants3"
endif
set RandNum to ( Random, 100 + 1)
if ( RandNum < 85 )
return
endif
if ( GetDistance, Player > 1024 )
Set timer to 0
return
endif
if ( CellChanged == 0 )
set RandNum to ( Random, 1000 + 1 )
If ( RandNum >= 666 )
PlaySound3DVP "plx_ES_plants1" ,1.0 ,1.0
elseIf ( RandNum >= 333 )
PlaySound3DVP "plx_ES_plants2" ,1.0 ,1.0
else
PlaySound3DVP "plx_ES_plants3" ,1.0 ,1.0
endif
endif
end
...