Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Сode
nightsxp Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2011
Reputation: 0
#1
Сode

hi all C: how can I make code lock?._. (player must enter the code to open door)
02-23-2013, 11:40 AM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#2
RE: Сode

Enter the code how?

[Image: 16455.png]
02-23-2013, 11:42 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
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
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#4
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?

[Image: 16455.png]
(This post was last modified: 02-23-2013, 11:48 AM by MulleDK19.)
02-23-2013, 11:47 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
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.
(This post was last modified: 02-23-2013, 11:48 AM by FlawlessHappiness.)
02-23-2013, 11:48 AM
Find
nightsxp Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2011
Reputation: 0
#6
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
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Сode

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.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
02-23-2013, 12:51 PM
Find
Tiger Away
Posting Freak

Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation: 55
#8
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
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#9
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.

[Image: 16455.png]
(This post was last modified: 02-23-2013, 12:57 PM by MulleDK19.)
02-23-2013, 12:55 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#10
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.

PHP Code: (Select All)
const string correctCode "6274";
string playersGuessedCode "";

void OnStart(){}

void OnEnter()
{
    
SetLocalVarInt("ButtonsPressed"0);
    
    for(
int i=1i<=9i++) {
        
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: "+playersGuessedCodefalse);
    
    if(
playersGuessedCode == correctCode) {
        
// unlock door or whatever here
        
for(int i=1i<=9i++) {
            
SetEntityActive("PressButton_"+ifalse);
        }
        
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(){} 

In Ruins [WIP]
(This post was last modified: 02-23-2013, 06:21 PM by NaxEla.)
02-23-2013, 06:12 PM
Find




Users browsing this thread: 1 Guest(s)