| 
		
	
		| nightsxp   Member
 
 Posts: 53
 Threads: 8
 Joined: Sep 2011
 Reputation: 
0
 | 
			| Сode 
 
				hi all C: how can I make code lock?._. (player must enter the code to open door)
			 |  |  
	| 02-23-2013, 11:40 AM |  |  
	
		| MulleDK19   Senior Member
 
 Posts: 545
 Threads: 21
 Joined: Jun 2009
 Reputation: 
10
 | 
			| RE: Сode 
 
				Enter the code how?
			 
 |  |  
	| 02-23-2013, 11:42 AM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Сode 
 
				 (02-23-2013, 11:42 AM)MulleDK19 Wrote:  Enter the code how? 
I think he meant inputting a code, then a door unlocks. Just like in Penumbra: Overture.
			 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 02-23-2013, 11:46 AM |  |  
	
		| MulleDK19   Senior Member
 
 Posts: 545
 Threads: 21
 Joined: Jun 2009
 Reputation: 
10
 | 
			| RE: Сode 
 
				 (02-23-2013, 11:46 AM)JustAnotherPlayer Wrote:   (02-23-2013, 11:42 AM)MulleDK19 Wrote:  Enter the code how? I think he meant inputting a code, then a door unlocks. Just like in Penumbra: Overture.
 
I know. But with what? There are no keypads in Amnesia. So does he have his own keypad, or does he want to use levers, or wheels?
			 
 
				
(This post was last modified: 02-23-2013, 11:48 AM by MulleDK19.)
 |  |  
	| 02-23-2013, 11:47 AM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Сode 
 
				It's a little advanced puzzle.
 You will firstly need a model with the numbers.
 Then cover each number in a script area, and create the code from with interaction callbacks.
 
 You will be needing variables and if-statements.
 
 When you know how the script functions work, you should be able to script it yourself
 
 Trying is the first step to success. |  |  
	| 02-23-2013, 11:48 AM |  |  
	
		| nightsxp   Member
 
 Posts: 53
 Threads: 8
 Joined: Sep 2011
 Reputation: 
0
 | 
			| RE: Сode 
 
				 (02-23-2013, 11:48 AM)BeeKayK Wrote:  It's a little advanced puzzle.
 You will firstly need a model with the numbers.
 Then cover each number in a script area, and create the code from with interaction callbacks.
 
 You will be needing variables and if-statements.
 
 When you know how the script functions work, you should be able to script it yourself
 
I don't understand theese "if" anyway there will be 9 buttuns ._. from amnesia
			 |  |  
	| 02-23-2013, 12:03 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 |  |  
	| 02-23-2013, 12:51 PM |  |  
	
		| Tiger   Posting Freak
 
 Posts: 1,874
 Threads: 16
 Joined: Nov 2012
 Reputation: 
55
 | 
			| RE: Сode 
 
				yeah, use buttons, you can scale them down if you want to so that'll be good. I would probably try using this  and somehow figure out the rest of it. I remember seeing a tutorial somewhere about opening a door with multiple levers so it should be fairly easy.
			 |  |  
	| 02-23-2013, 12:52 PM |  |  
	
		| MulleDK19   Senior Member
 
 Posts: 545
 Threads: 21
 Joined: Jun 2009
 Reputation: 
10
 | 
			| RE: Сode 
 
				 (02-23-2013, 12:51 PM)The chaser Wrote:  buttuns pls
 dnalange made something seemed, this is the thread:
 
 http://www.frictionalgames.com/forum/thread-19588.html
 
 As you can see, it's quite complicated, but he finally got it working.
 
Fuck me. He needs a scripting course.
 
I made this once. Doesn't fill more than 30 lines.
			 
 
				
(This post was last modified: 02-23-2013, 12:57 PM by MulleDK19.)
 |  |  
	| 02-23-2013, 12:55 PM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: Сode 
 
				I made a code for this a while ago... let me see if I still have it. 
EDIT: Ok found it. This code will work if the script areas are called PressButton_1, PressButton_2, PressButton_3, etc... If you want to change the password, just change the number at the very top of the script.
 const string correctCode = "6274";string playersGuessedCode = "";
 
 void OnStart(){}
 
 void OnEnter()
 {
 SetLocalVarInt("ButtonsPressed", 0);
 
 for(int i=1; i<=9; i++) {
 SetEntityPlayerInteractCallback("PressButton_"+i, "PressedButton", false);
 }
 }
 
 void PressedButton(string &in entity)
 {
 int buttonsPressed;
 
 AddLocalVarInt("ButtonsPressed", 1);
 
 playersGuessedCode += GetButtonPressed(entity);
 buttonsPressed = GetLocalVarInt("ButtonsPressed");
 
 AddDebugMessage("Buttons Pressed: "+buttonsPressed+"  Guessed Code: "+playersGuessedCode, false);
 
 if(playersGuessedCode == correctCode) {
 // unlock door or whatever here
 for(int i=1; i<=9; i++) {
 SetEntityActive("PressButton_"+i, false);
 }
 ResetCode();
 AddDebugMessage("Correct code!", false);
 
 return;
 }
 
 if(buttonsPressed == 4) {
 ResetCode();
 AddDebugMessage("Wrong code!", false);
 }
 }
 
 void ResetCode()
 {
 SetLocalVarInt("ButtonsPressed", 0);
 playersGuessedCode = "";
 }
 
 string GetButtonPressed(string entity)
 {
 if(entity == "PressButton_1") {
 return "1";
 }
 else if(entity == "PressButton_2") {
 return "2";
 }
 else if(entity == "PressButton_3") {
 return "3";
 }
 else if(entity == "PressButton_4") {
 return "4";
 }
 else if(entity == "PressButton_5") {
 return "5";
 }
 else if(entity == "PressButton_6") {
 return "6";
 }
 else if(entity == "PressButton_7") {
 return "7";
 }
 else if(entity == "PressButton_8") {
 return "8";
 }
 else if(entity == "PressButton_9") {
 return "9";
 }
 else {
 return "";
 }
 }
 
 void OnLeave(){}
 
 
				
(This post was last modified: 02-23-2013, 06:21 PM by NaxEla.)
 |  |  
	| 02-23-2013, 06:12 PM |  |  |