| 
		
	
		| Shadowfied   Senior Member
 
 Posts: 261
 Threads: 34
 Joined: Jul 2010
 Reputation: 
5
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:30 AM)Tripication Wrote:   (01-15-2012, 11:28 AM)Shadowfied Wrote:  You only added the 4 stuckstate lines at the end? (Just so I learn I did, but did it work? ) No, it didn't. =/ Didn't make any noticeable difference.
 
Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck" 
That's probably it...right?
			 
 
				
(This post was last modified: 01-15-2012, 11:32 AM by Shadowfied.)
 |  |  
	| 01-15-2012, 11:31 AM |  |  
	
		| Tripication   Member
 
 Posts: 172
 Threads: 19
 Joined: Dec 2011
 Reputation: 
6
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:31 AM)Shadowfied Wrote:   (01-15-2012, 11:30 AM)Tripication Wrote:  No, it didn't. =/ Didn't make any noticeable difference. (01-15-2012, 11:28 AM)Shadowfied Wrote:  You only added the 4 stuckstate lines at the end? (Just so I learn I did, but did it work? ) 
 Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck"
 That's probably it...right?
 That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure.  
(The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
custom function called each time a lever is correctly in place. when all are in place, the function continues. 
 
So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
			 
  ![[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]](http://fc06.deviantart.net/fs70/f/2012/125/c/d/speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png)  |  |  
	| 01-15-2012, 11:39 AM |  |  
	
		| Shadowfied   Senior Member
 
 Posts: 261
 Threads: 34
 Joined: Jul 2010
 Reputation: 
5
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:39 AM)Tripication Wrote:   (01-15-2012, 11:31 AM)Shadowfied Wrote:  That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure. (01-15-2012, 11:30 AM)Tripication Wrote:  No, it didn't. =/ Didn't make any noticeable difference. (01-15-2012, 11:28 AM)Shadowfied Wrote:  You only added the 4 stuckstate lines at the end? (Just so I learn I did, but did it work? ) 
 Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck"
 That's probably it...right?
 (The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
 custom function called each time a lever is correctly in place. when all are in place, the function continues.
 
 So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
 I don't really understand why I shall have that box ticked. The levers don't get stuck anyway..do they?
 
Edit: Nevermind. They do get stuck..
 
Edit 2: Ok I saw that Statyk had them getting stuck in up and down states in every func. I removed them and now it works the way I want, they only get stuck once they are all correct.
			 
 
				
(This post was last modified: 01-15-2012, 11:46 AM by Shadowfied.)
 |  |  
	| 01-15-2012, 11:43 AM |  |  
	
		| Tripication   Member
 
 Posts: 172
 Threads: 19
 Joined: Dec 2011
 Reputation: 
6
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:43 AM)Shadowfied Wrote:   (01-15-2012, 11:39 AM)Tripication Wrote:  I don't really understand why I shall have that box ticked. The levers don't get stuck anyway..do they? (01-15-2012, 11:31 AM)Shadowfied Wrote:  That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure. (01-15-2012, 11:30 AM)Tripication Wrote:  No, it didn't. =/ Didn't make any noticeable difference. (01-15-2012, 11:28 AM)Shadowfied Wrote:  You only added the 4 stuckstate lines at the end? (Just so I learn I did, but did it work? ) 
 Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck"
 That's probably it...right?
 (The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
 custom function called each time a lever is correctly in place. when all are in place, the function continues.
 
 So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
 
 Edit: Nevermind. They do get stuck..
 They shouldn't. Just try it anyway, im sure its nothing you cant undo. 
			 
  ![[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]](http://fc06.deviantart.net/fs70/f/2012/125/c/d/speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png)  |  |  
	| 01-15-2012, 11:46 AM |  |  
	
		| Shadowfied   Senior Member
 
 Posts: 261
 Threads: 34
 Joined: Jul 2010
 Reputation: 
5
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:46 AM)Tripication Wrote:   (01-15-2012, 11:43 AM)Shadowfied Wrote:  They shouldn't. Just try it anyway, im sure its nothing you cant undo. (01-15-2012, 11:39 AM)Tripication Wrote:  I don't really understand why I shall have that box ticked. The levers don't get stuck anyway..do they? (01-15-2012, 11:31 AM)Shadowfied Wrote:  That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure. (01-15-2012, 11:30 AM)Tripication Wrote:  I did, but did it work?No, it didn't. =/ Didn't make any noticeable difference. 
 Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck"
 That's probably it...right?
 (The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
 custom function called each time a lever is correctly in place. when all are in place, the function continues.
 
 So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
 
 Edit: Nevermind. They do get stuck..
 Read my edit 2. ^^
			 
 |  |  
	| 01-15-2012, 11:47 AM |  |  
	
		| Tripication   Member
 
 Posts: 172
 Threads: 19
 Joined: Dec 2011
 Reputation: 
6
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:47 AM)Shadowfied Wrote:   (01-15-2012, 11:46 AM)Tripication Wrote:  Read my edit 2. ^^ (01-15-2012, 11:43 AM)Shadowfied Wrote:  They shouldn't. Just try it anyway, im sure its nothing you cant undo. (01-15-2012, 11:39 AM)Tripication Wrote:  I don't really understand why I shall have that box ticked. The levers don't get stuck anyway..do they? (01-15-2012, 11:31 AM)Shadowfied Wrote:  No, it didn't. =/ Didn't make any noticeable difference.That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure.
 Edit: I think I know why though, Statyk told me to check the box "InteractionDisablesStuck"
 That's probably it...right?
 (The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
 custom function called each time a lever is correctly in place. when all are in place, the function continues.
 
 So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
 
 Edit: Nevermind. They do get stuck..
 Oh, that sucks, hang on, i've just had a brillian stroke of genius... 
Next post...
			 
  ![[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]](http://fc06.deviantart.net/fs70/f/2012/125/c/d/speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png)  |  |  
	| 01-15-2012, 11:49 AM |  |  
	
		| Shadowfied   Senior Member
 
 Posts: 261
 Threads: 34
 Joined: Jul 2010
 Reputation: 
5
 | 
			| RE: Need help to make a lever puzzle 
 
				 (01-15-2012, 11:49 AM)Tripication Wrote:   (01-15-2012, 11:47 AM)Shadowfied Wrote:  Oh, that sucks, hang on, i've just had a brillian stroke of genius... (01-15-2012, 11:46 AM)Tripication Wrote:  Read my edit 2. ^^ (01-15-2012, 11:43 AM)Shadowfied Wrote:  They shouldn't. Just try it anyway, im sure its nothing you cant undo. (01-15-2012, 11:39 AM)Tripication Wrote:  That could possible be it, although its probably better to wait for him to help you out. ive it a shot if you want, but once again, i dont have too much experience with this kinda thing, so i wouldn't be sure. I don't really understand why I shall have that box ticked. The levers don't get stuck anyway..do they?(The levers should only get stuck once the puzzle is complete, i put the SetLeverStuckState lines in the last function, and statyk does say...
 
 custom function called each time a lever is correctly in place. when all are in place, the function continues.
 
 So assuming that the boxes are unticked, it should work. But i dont EXACTLY know what the boxes do so be sure that you can fix it if it does stuff up)
 
 Edit: Nevermind. They do get stuck..
 Next post...
 Well, thanks for your help. =)
			 
 |  |  
	| 01-15-2012, 11:50 AM |  |  
	
		| Tripication   Member
 
 Posts: 172
 Threads: 19
 Joined: Dec 2011
 Reputation: 
6
 | 
			| RE: Need help to make a lever puzzle 
 
				Try Duplicating the levers and deactivating the duplicates, turn the InteractionDisablesStuck off on the Inactive duplicates and do this 
void OnStart() 
{ 
SetEntityConnectionStateChangeCallback("LEVER1", "lever1func"); //levercallback 
SetEntityConnectionStateChangeCallback("LEVER2", "lever2func"); //levercallback 
SetEntityConnectionStateChangeCallback("LEVER3", "lever3func"); //levercallback 
SetEntityConnectionStateChangeCallback("LEVER4", "lever4func"); //levercallback
 
SetLocalVarInt("lever1bank", 0); //'dem banks! 
SetLocalVarInt("lever2bank", 0); //'dem banks!  
SetLocalVarInt("lever3bank", 0); //'dem banks!  
SetLocalVarInt("lever4bank", 0); //'dem banks!  
}
 
/////////////////////////////////////////////////////////
 
void lever1func(string &in asEntity, int alState) 
{ 
if(alState == 1)  
{ 
SetLeverStuckState("LEVER1", 1, true); //sets it stuck 
SetLocalVarInt("lever1bank", 1); //add dat cash munay 
CheckFunction(); //follows function at the bottom, which activates the completed puzzle 
} 
if(alState == -1) 
{ 
SetLeverStuckState("LEVER1", -1, true); 
SetLocalVarInt("lever1bank", 0); 
} 
}
 
//////////////////////////////////////////////////////////////////////
 
void lever2func(string &in asEntity, int alState) 
{ 
if(alState == 1) 
{ 
SetLeverStuckState("LEVER2", 1, true); 
SetLocalVarInt("lever2bank", 1); 
CheckFunction(); 
} 
if(alState == -1) 
{ 
SetLeverStuckState("LEVER2", -1, true); 
SetLocalVarInt("lever2bank", 0); 
} 
}
 
//////////////////////////////////////////////////////////////////////
 
void lever3func(string &in asEntity, int alState) //follows a different "if" statement, making it opposite from the rest or... Down rather than Up. 
{ 
if(alState == 1) 
{ 
SetLeverStuckState("LEVER3", 1, true); 
SetLocalVarInt("lever3bank", 0); 
} 
if(alState == -1) 
{ 
SetLeverStuckState("LEVER3", -1, true); 
SetLocalVarInt("lever3bank", 1); 
CheckFunction(); 
} 
}
 
//////////////////////////////////////////////////////////////////////
 
void lever4func(string &in asEntity, int alState) 
{ 
if(alState == 1) 
{ 
SetLeverStuckState("LEVER4", 1, true); 
SetLocalVarInt("lever4bank", 1); 
CheckFunction(); 
} 
if(alState == -1) 
{ 
SetLeverStuckState("LEVER4", -1, true); 
SetLocalVarInt("lever4bank", 0); 
} 
}
 
//////////////////////////
 
void CheckFunction() //custom function called each time a lever is correctly in place. when all are in place, the function continues. 
{ 
if(GetLocalVarInt("lever1bank") == 1 && GetLocalVarInt("lever2bank") == 1 && GetLocalVarInt("lever3bank") == 1 && GetLocalVarInt("lever4bank") == 1) 
{
 SetEntityActive("LEVER1", false); SetEntityActive("LEVER2", false);
 SetEntityActive("LEVER3", false);
 SetEntityActive("LEVER4", false);
 SetEntityActive("LEVER1_1", true);
 SetEntityActive("LEVER2_1", true);
 SetEntityActive("LEVER3_1", true);
 SetEntityActive("LEVER4_1", true);SetLeverStuckState("LEVER1_1", 1, false);
 SetLeverStuckState("LEVER2_1", 1, false);
 SetLeverStuckState("LEVER3_1", -1, false);
 SetLeverStuckState("LEVER4_1", 1, false);
 
GiveSanityBoost(); 
SetSwingDoorLocked("LEVERDOOR", false, true); 
} 
}
 
I'm assuming the Duplicates will have a _1 at the end of the original name.
 
Ya dig? 
(NOTE:May not be Genius...BACKUPS BEFORE COMPLAINING)
			
  ![[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]](http://fc06.deviantart.net/fs70/f/2012/125/c/d/speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png)  |  |  
	| 01-15-2012, 11:53 AM |  |  
	
		| Shadowfied   Senior Member
 
 Posts: 261
 Threads: 34
 Joined: Jul 2010
 Reputation: 
5
 | 
			| RE: Need help to make a lever puzzle 
 
				Uhm..I thought I already told you I solved it?
 Statyk had put "SetLeverStuckState("LEVER4", 1, true);" in every function, removing all of those and adding your "SetLeverStuckState" scripts at the end solved it. There was no reason (not that I understand anyway) to make them stuck all the time and using the InteractDisablesStuck checkbox for this situation.
 
 |  |  
	| 01-15-2012, 11:55 AM |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: Need help to make a lever puzzle 
 
				Here's a more efficient way of doing it (though entirely untested).  const string[] lever_names = {"LEVER1", "LEVER2", "LEVER3", "LEVER4"}const int[] desired_lever_states = {1, 1, -1, 1}
 
 /******************************************************************************/
 
 void OnStart()
 {
 SetEntityConnectionStateChangeCallback("LEVER1", "lever_func");
 SetEntityConnectionStateChangeCallback("LEVER2", "lever_func");
 SetEntityConnectionStateChangeCallback("LEVER3", "lever_func");
 SetEntityConnectionStateChangeCallback("LEVER4", "lever_func");
 
 SetLocalVarInt("LEVER1", 0);
 SetLocalVarInt("LEVER2", 0);
 SetLocalVarInt("LEVER3", 0);
 SetLocalVarInt("LEVER4", 0);
 }
 
 /******************************************************************************/
 
 void lever_func(string &in asEntity, int alState)
 {
 if (GetLocalVarInt("LEVER_PUZZLE_COMPLETE") == 1)
 return;
 
 SetLocalVarInt(asEntity, alState);
 CheckFunction();
 }
 
 /******************************************************************************/
 
 void CheckFunction()
 {
 for (int i = 0; i < lever_names.length(); ++i)
 {
 if (GetLocalVarInt(lever_names[i]) != desired_lever_states[i])
 return;
 else
 {
 SetLeverStuckState(lever_names[i], desired_lever_states[i], true);
 SetEntityConnectionStateChangeCallback(lever_names[i], "");
 }
 }
 
 GiveSanityBoost();
 SetSwingDoorLocked("LEVERDOOR", false, true);
 SetLocalVarInt("LEVER_PUZZLE_COMPLETE", 1);
 }
 
 |  |  
	| 01-15-2012, 11:56 AM |  |  |