Frictional Games Forum (read-only)
Сode - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Сode (/thread-20464.html)

Pages: 1 2


Сode - nightsxp - 02-23-2013

hi all C: how can I make code lock?._. (player must enter the code to open door)


RE: Сode - MulleDK19 - 02-23-2013

Enter the code how?


RE: Сode - PutraenusAlivius - 02-23-2013

(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.


RE: Сode - MulleDK19 - 02-23-2013

(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?


RE: Сode - FlawlessHappiness - 02-23-2013

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


RE: Сode - nightsxp - 02-23-2013

(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


RE: Сode - The chaser - 02-23-2013

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.


RE: Сode - Tiger - 02-23-2013

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.


RE: Сode - MulleDK19 - 02-23-2013

(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.


RE: Сode - NaxEla - 02-23-2013

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:
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(){}