FANDOM


Created by Taz.

Using "RC_Core.rcm"
; Define entry function 'Main'

Function Main()

Player = Actor()
Target = ContextActor()

SoundPlaying% = 0
CounttoPlaySound% = 0
Repeat
Trig1% = ActorInTrigger(Player, 0)
CounttoPlaySound% = CounttoPlaySound + 1

 
 	If (Trig1 = 1) ;player is in triger
 	  If (SoundPlaying = 0)
 	;Player Random speech when player is in triger
 		RandSpeech% = Rand(1, 7)
 		
 			If (RandSpeech = 1)  		
 				PlaySound(Player, 22)
 				SoundPlaying% = 1
 			EndIf
 			
 			If (RandSpeech = 7) 
 				PlaySound(Player, 23)
 				SoundPlaying% = 1
 			EndIf
 			
 			If (RandSpeech = 4) 
 				PlaySound(Player, 27)
 				SoundPlaying% = 1
 			EndIf
 			
 			
 	  EndIf
 			
 	;25 26
 	
 	DoEvents(900) ; change to higher after testing
 	EndIf
 
 
 		If (Trig1 = 0)  ;player out of trigger do random bye
 		  If (SoundPlaying = 0)	
 				RandByeSpeech% = Rand(1, 7)
 		
 			If (RandByeSpeech = 1)  		
 				PlaySound(Player, 25)
 				SoundPlaying% = 1
 			EndIf
 			
 			If (RandByeSpeech = 7) 
 				PlaySound(Player, 26)
 				SoundPlaying% = 1
 			EndIf
 	      EndIf
 			
 		
 		
 
 		EndIf
 		
 		
 
 If (CounttoPlaySound >= 125) ;restart counter and sound start
 CounttoPlaySound% = 0
 SoundPlaying% = 0
 EndIf
 
 
 
 Until (Trig1 = 0)
 
 
 End Function