Frictional Games Forum (read-only)
How to unlock door with key? - 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: How to unlock door with key? (/thread-5650.html)

Pages: 1 2 3


RE: How to unlock door with key? - Tirilno - 07-06-2011

(07-06-2011, 10:26 PM)Kyle Wrote:
(07-06-2011, 10:18 PM)Tirilno Wrote: Can you guys please look at my script? Smile I have tried everyting and looked through every 'how to' and tutorial videos I find but I can't unlock my door -.- I want my door to be open when I use the key, but It's still locked after I use it :/ (I'm using a level door) Tongue

void OnStart()
{
AddUseItemCallback("", "Storagekey_1", "Storagedoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Storagedoor", false, true);
PlaySoundAtEntity("", "Unlock_door", "Storagedoor", 0, false);
}
void OnLeave()
{

}

For level doors you have to use this:

SetLevelDoorLocked(string& asName, bool abLocked);

Try this:

Code:
void OnStart()
{
   AddUseItemCallback("", "Storagekey_1", "Storagedoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
     SetLevelDoorLocked("Storagedoor", false);
     PlaySoundAtEntity("", "unlock_door", "Storagedoor", 0, false);
}
void OnLeave()
{

}
Haha, now I understand why it didn't work.. xD Thank you so much Smile



RE: How to unlock door with key? - Zypherzemus - 07-07-2011

Hmm.. anyone know how to unlock a level door (on one map) with a key from another map?
I'm sure it's possible.


RE: How to unlock door with key? - Kyle - 07-08-2011

(07-07-2011, 08:36 PM)Snuffalofagus Wrote: Hmm.. anyone know how to unlock a level door (on one map) with a key from another map?
I'm sure it's possible.

Did you try it? I'm pretty sure it would work as it is. Or check in the main Amnesia game.


RE: How to unlock door with key? - Zypherzemus - 07-08-2011

(07-08-2011, 01:12 AM)Kyle Wrote:
(07-07-2011, 08:36 PM)Snuffalofagus Wrote: Hmm.. anyone know how to unlock a level door (on one map) with a key from another map?
I'm sure it's possible.

Did you try it? I'm pretty sure it would work as it is. Or check in the main Amnesia game.

Your suggestion from the other thread? I thought about it and came to the conclusion that it might not work (If you say to post that command in the second level before you unlock the door)
Here's how my story is set up.
4 Maps, the first map (hub map) and then the other 3.
There's a key to unlock a door on the hub map, but that specific key for that specific door is in one of the other levels. I don't know if it would work since the door itself is on the hub map
I'll try though. Where should I post it though? the hub map? or the map the key is in?


RE: how do i do a jump scare - drumslaya - 09-21-2012

ivé looked at many videos on how to do a jump scare and this is my scripting but every time i go into my custom map it comes up with a message saying
FATAL ERROR
this is my scripting please help!!!!


void onstart()(
setentitycallbackfunc("key_1", "jump");
}
void jump(string &in asentity, starting &in type)(
setentityactive("corpse_bloody_1", true);
playguisound("21/21_scream10.ogg", 1.0f);
)


RE: How to unlock door with key? - Robby - 09-21-2012

Correct script:

void onstart()
{
SetEntityCallbackFunc("key_1", "jump");
}
void jump(string &in asEntity, string &in astype)
{
SetEntityActive("corpse_bloody_1", true);
PlayGuiSound("21_scream10.ogg", 1.0f);
}


This shall work.


RE: How to unlock door with key? - GSphoenix - 09-26-2012

////////////////////////
//Run when Starting map
void OnStart()
{
AddUseItemCallback("", "OfficeKey", "mansion_1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, false);
RemoveItem("OfficeKey");
AddDebugMessage("KeyOnDoor", false);
}


////////////////////////
//Run when Entering map
void OnEnter()
{


}


///////////////////////
//Run when Leaving map
void OnLeave()
{


}


Help plz what is wrong?


RE: How to unlock door with key? - Statyk - 09-26-2012

Is your game crashing? What is the error code that pops up when it crashes? We need some more info.


RE: How to unlock door with key? - Robby - 09-26-2012

(09-26-2012, 04:18 PM)GSphoenix Wrote: ////////////////////////
//Run when Starting map
void OnStart()
{
AddUseItemCallback("", "OfficeKey", "mansion_1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, false);
RemoveItem("OfficeKey");
AddDebugMessage("KeyOnDoor", false);
}
I'm not seeing anything wrong. I checked 6x.

Are you sure the names are correct (within the editor and the script)?

If you are getting an error, please say what kind. Like, look for numbers like (5,2). I used an example there.


RE: How to unlock door with key? - GSphoenix - 09-26-2012

////////////////////////
//Run when Starting map
void OnStart()
{
AddUseItemCallback("", "OfficeKey", "mansion_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, false);
RemoveItem("OfficeKey");
AddDebugMessage("KeyOnDoor", false);
}

////////////////////////
//Run when Entering map
void OnEnter()
{

}


///////////////////////
//Run when Leaving map
void OnLeave()
{

}

If I want to use it on the door its says: "cant use this item this way".
maybee the names in the editor are wrong, but i dont no with one...?