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


Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to unlock door with key?
Tirilno Offline
Junior Member

Posts: 27
Threads: 5
Joined: Jul 2011
Reputation: 0
#21
RE: How to unlock door with key?

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

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
07-06-2011, 10:32 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#22
RE: How to unlock door with key?

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

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#23
RE: How to unlock door with key?

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

07-08-2011, 01:12 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#24
RE: How to unlock door with key?

(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?
07-08-2011, 01:41 AM
Find
drumslaya Offline
Junior Member

Posts: 1
Threads: 0
Joined: Sep 2012
Reputation: 0
#25
Rainbow  RE: how do i do a jump scare

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);
)
09-21-2012, 01:43 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#26
RE: How to unlock door with key?

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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-21-2012, 02:04 PM
Website Find
GSphoenix Offline
Junior Member

Posts: 2
Threads: 0
Joined: Sep 2012
Reputation: 0
#27
RE: How to unlock door with key?

////////////////////////
//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?
09-26-2012, 04:18 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#28
RE: How to unlock door with key?

Is your game crashing? What is the error code that pops up when it crashes? We need some more info.
09-26-2012, 04:23 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#29
RE: How to unlock door with key?

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

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-26-2012, 04:25 PM
Website Find
GSphoenix Offline
Junior Member

Posts: 2
Threads: 0
Joined: Sep 2012
Reputation: 0
#30
RE: How to unlock door with key?

////////////////////////
//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...?
09-26-2012, 05:47 PM
Find




Users browsing this thread: 6 Guest(s)