Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 2 Votes - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to unlock door with key?
Author Message
Tirilno Offline
Junior Member

Posts: 27
Joined: Jul 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
drumslaya Offline
Junior Member

Posts: 1
Joined: Sep 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Nemet Robert Offline
Posting Freak

Posts: 2,377
Joined: Jun 2009
Reputation: 42
Post: #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.

Signature Gas Mask
09-21-2012 02:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
GSphoenix Offline
Junior Member

Posts: 2
Joined: Sep 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Statyk Offline
Modmau5

Posts: 3,609
Joined: Sep 2011
Reputation: 198
Post: #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
Visit this user's website Find all posts by this user Quote this message in a reply
Nemet Robert Offline
Posting Freak

Posts: 2,377
Joined: Jun 2009
Reputation: 42
Post: #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.

Signature Gas Mask
09-26-2012 04:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
GSphoenix Offline
Junior Member

Posts: 2
Joined: Sep 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)