| 
		
	
		| Angerpull   Member
 
 Posts: 88
 Threads: 24
 Joined: Jun 2011
 Reputation: 
0
 | 
			| Levers 
 
				How can I make a functional Lever to open a door? Can someone make a script for me to do this? 
The levers name is: Slaver_Lever 
The door's name is: Slaver_Lever_Door
 
Thanks in advance!
 
-Angerpull    |  |  
	| 07-27-2011, 08:08 PM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Levers 
 
				void MyFunction(string &in asEntity, int alState){
 if( alState == 1)
 {
 SetMoveObjectState("Slaver_Lever_Door", 1);
 }
 }
 
 
 Put this to your OnStart:
 SetEntityConnectionStateChangeCallback("Slaver_Lever", "MyFunction");
 
 |  |  
	| 07-27-2011, 08:15 PM |  |  
	
		| Angerpull   Member
 
 Posts: 88
 Threads: 24
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Levers 
 
				 (07-27-2011, 08:15 PM)Tanshaydar Wrote:  void MyFunction(string &in asEntity, int alState){
 if( alState == 1)
 {
 SetMoveObjectState("Slaver_Lever_Door", 1);
 }
 }
 
 
 Put this to your OnStart:
 SetEntityConnectionStateChangeCallback("Slaver_Lever", "MyFunction");
 
It doesn't work, the door doesn't unlock or anything. The lever just moves up and down and won't do anything to the door. It just keeps itself locked.
			 |  |  
	| 07-27-2011, 08:27 PM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Levers 
 
				Is it a traditional door? I thought it was a door that moves upside. 
Anyway, here's the code for you:
 void MyFunction(string &in asEntity, int alState){
 if( alState == 1)
 {
 SetSwingDoorLocked("Slaver_Lever_Door", false, true);
 }
 }
 |  |  
	| 07-27-2011, 08:32 PM |  |  
	
		| Angerpull   Member
 
 Posts: 88
 Threads: 24
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Levers 
 
				 (07-27-2011, 08:32 PM)Tanshaydar Wrote:  Is it a traditional door? I thought it was a door that moves upside.Anyway, here's the code for you:
 
 
 void MyFunction(string &in asEntity, int alState){
 if( alState == 1)
 {
 SetSwingDoorLocked("Slaver_Lever_Door", false, true);
 }
 }
 
It still doesn't work. Do I have to do something about the lever? Or anything? The door doesn't unlock and it just doesn work. Anything wrong with the script?
 |  |  
	| 07-27-2011, 08:44 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Levers 
 
				If I need to do this: void OnStart(){
 SetEntityConnectionStateChangeCallback("Slaver_Lever", "Lever_Slaver");
 }
 void Lever_Slaver(string &in asEntity, int alState)
 {
 if (alState == 1)
 {
 SetSwingDoorLocked("Slaver_Lever_Door", false, true);
 }
 }
 |  |  
	| 07-27-2011, 08:50 PM |  |  
	
		| Angerpull   Member
 
 Posts: 88
 Threads: 24
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Levers 
 
				 (07-27-2011, 08:50 PM)Kyle Wrote:  If I need to do this:
 
 void OnStart(){
 SetEntityConnectionStateChangeCallback("Slaver_Lever", "Lever_Slaver");
 }
 void Lever_Slaver(string &in asEntity, int alState)
 {
 if (alState == 1)
 {
 SetSwingDoorLocked("Slaver_Lever_Door", false, true);
 }
 }
 
Still doesn't work. This is frustrating. The door keeps shut, the lever can only be moved up and down with nothing happening.
			 |  |  
	| 07-27-2011, 08:59 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Levers 
 
				Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/
			 
 |  |  
	| 07-27-2011, 09:26 PM |  |  
	
		| Angerpull   Member
 
 Posts: 88
 Threads: 24
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Levers 
 
				 (07-27-2011, 09:26 PM)Kyle Wrote:  Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/ 
Everything is named correctly. Why won't it work? Can you maybe make your own level and name the door and the lever the same and test it?
			 |  |  
	| 07-27-2011, 09:35 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Levers 
 
				 (07-27-2011, 09:35 PM)Angerpull Wrote:   (07-27-2011, 09:26 PM)Kyle Wrote:  Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/ Everything is named correctly. Why won't it work? Can you maybe make your own level and name the door and the lever the same and test it?
 
I made it exactly with the same names and the same script pieces. It works perfectly, and the way it should. I'm not sure why it doesn't work for you... :/
			 
 |  |  
	| 07-27-2011, 09:50 PM |  |  |