| 
		
	
		| Hauken   Member
 
 Posts: 62
 Threads: 19
 Joined: Jul 2012
 Reputation: 
1
 | 
			| Lever when pull play sound 
 
				Hi 
Im trying to connect a lever to a door which is working 
However i want a sound to play once i pull it, I've been messing around looking at the script wiki page but after I did this i get a error token saying 9,1 "{" is wrong.
 void OnStart(){
 InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
 PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
 }
 
 void SetEntityPlayerInteractCallback("","Soundlever", true);
 
 {
 PlaySoundAtEntity("","quest_completed.snt","slidedoor");
 }
Currently i have a simple lever connected to a door, it is facing upwards and if i pull it it will stuck and the door opens. Easy and working.
 
The trouble is the sound i want to play when pull!
 
Im sure you guys can see the problem already    
Edit: the Playmusic is just temp so it wont be so silent when im testing around..
			
				
(This post was last modified: 04-14-2013, 12:25 AM by Hauken.)
 |  |  
	| 04-13-2013, 10:19 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Lever when pull play sound 
 
				 (04-13-2013, 10:19 PM)Hauken Wrote:  Hi
 Im trying to connect a lever to a door which is working
 However i want a sound to play once i pull it, I've been messing around looking at the script wiki page but after I did this i get a error token saying 9,1 "{" is wrong.
 
 
 void OnStart(){
 InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
 PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
 }
 
 void SetEntityPlayerInteractCallback("","Soundlever", true);
 
 {
 PlaySoundAtEntity("","quest_completed.snt","slidedoor");
 }
Currently i have a simple lever connected to a door, it is facing upwards and if i pull it it will stuck and the door opens. Easy and working.
 
 The trouble is the sound i want to play when pull!
 
 Im sure you guys can see the problem already
  
 Edit: the Playmusic is just temp so it wont be so silent when im testing around..
 
void OnStart() 
{ 
	InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0); 
	PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
       AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1); 
}
 
void DoSound (string &in asParent, string &in asChild, int alState) 
{ 
	PlaySoundAtEntity("","quest_completed.snt","slidedoor"); 
}
 
Make an area which is IN the slidedoor. Scale it enough so that when the slide door reaches the top, the area finishes. The -1 that I used in the CollideCallback function means that when slidedoor goes out of the area, the sound will happen.
			 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan.
				
(This post was last modified: 04-13-2013, 10:37 PM by The chaser.)
 |  |  
	| 04-13-2013, 10:37 PM |  |  
	
		| Hauken   Member
 
 Posts: 62
 Threads: 19
 Joined: Jul 2012
 Reputation: 
1
 | 
			| RE: Lever when pull play sound 
 
				I will try this
 Thanks for response!
 |  |  
	| 04-13-2013, 10:38 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Lever when pull play sound 
 
				I'm here to help   
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 04-13-2013, 10:42 PM |  |  
	
		| Hauken   Member
 
 Posts: 62
 Threads: 19
 Joined: Jul 2012
 Reputation: 
1
 | 
			| RE: Lever when pull play sound 
 
				![[Image: kcjdyr.png]](http://i46.tinypic.com/kcjdyr.png)  
This was the result, i also had the editor with the pic so you can the placement of the ScriptArea.
 
I know by the values provided from that fault message I should know where to fix but I am a big noob at this and im still learning.    
Save pic to see enlarged !
 void OnStart(){
 InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
 PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
 AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
 }
 
 void DoSound (string &in asParent, string &in asChild, int alState)
 
 {
 PlaySoundAtEntity("","quest_completed.snt","slidedoor");
 }
 
				
(This post was last modified: 04-13-2013, 10:52 PM by Hauken.)
 |  |  
	| 04-13-2013, 10:48 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Lever when pull play sound 
 
				 (04-13-2013, 10:48 PM)Hauken Wrote:  ![[Image: kcjdyr.png]](http://i46.tinypic.com/kcjdyr.png) 
 This was the result, i also had the editor with the pic so you can the placement of the ScriptArea.
 
 I know by the values provided from that fault message I should know where to fix but I am a big noob at this and im still learning.
  
 Save pic to see enlarged !
 
 
 void OnStart(){
 InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
 PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
 AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
 }
 
 void DoSound (string &in asParent, string &in asChild, int alState)
 
 {
 PlaySoundAtEntity("","quest_completed.snt","slidedoor");
 }
 
It should be:
 void OnStart(){
 InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
 PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
 AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
 }
 
 void DoSound (string &in asParent, string &in asChild, int alState)
 
 {
 PlaySoundAtEntity("","quest_completed.snt","slidedoor", false);
 }
The area should be where the door is in the beggining, like:
http://i.imgur.com/5oXViXg.jpg 
Sorry, didn't find the slide door entity    
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 04-13-2013, 11:06 PM |  |  
	
		| Hauken   Member
 
 Posts: 62
 Threads: 19
 Joined: Jul 2012
 Reputation: 
1
 | 
			| RE: Lever when pull play sound 
 
				![[Image: aykls6.png]](http://i46.tinypic.com/aykls6.png)  
The result with the exact copy paste you gave me.
 
slidedoor = my door entity 
valve = my lever entity
 
PlaySoundAtEntity("","quest_completed.snt","slidedoor"
 
The fault obvioussly lies in that line...
			 
				
(This post was last modified: 04-13-2013, 11:29 PM by Hauken.)
 |  |  
	| 04-13-2013, 11:26 PM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: Lever when pull play sound 
 
				Try:
 PlaySoundAtEntity("","quest_completed.snt","slidedoor", 0, false);
 
 |  |  
	| 04-13-2013, 11:42 PM |  |  
	
		| Hauken   Member
 
 Posts: 62
 Threads: 19
 Joined: Jul 2012
 Reputation: 
1
 | 
			| RE: Lever when pull play sound 
 
				That solved the crash, the sound however doesn't work - I bet it has something to do with my scriptarea.
 Let me mess around with it some time, I do need to call it "Arealeave" right?
 
 Ok, thanks to both of you!
 
 This script is fully functional now, now I just need some smoke effects and sanity boost and im there.
 Aint to hard to do is it?
 
				
(This post was last modified: 04-13-2013, 11:58 PM by Hauken.)
 |  |  
	| 04-13-2013, 11:51 PM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: Lever when pull play sound 
 
				In chaser's script, it's "AreaLeave" (with a capital L)
			 
 |  |  
	| 04-13-2013, 11:58 PM |  |  |