Keys and Doors - 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) +--- Thread: Keys and Doors (/thread-18774.html) |
Keys and Doors - tehwhynot - 10-14-2012 Hello here is the thing, i want to have some keys to open some doors but i dont know how to make a script for, I dont know, 10 doors or something.If you guys can help i apreciated. RE: Keys and Doors - Ongka - 10-14-2012 Don't even think of having 10 keys in one map, it kills the gameplay. But i could still help you out just so you can understand the script. Tell me what you already know. Can you open one door with a key or do you want the learn the whole script? RE: Keys and Doors - tehwhynot - 10-14-2012 Yeah i watch a tutorial on how to use a key to open a door and this is the script: //////////////////////////// //Run first time starting map void OnStart() { AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_1", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false); RemoveItem("key_1"); } I tried to copy everything exept run first time and voidOnstart and I got a ERROR. Help me pls RE: Keys and Doors - Ongka - 10-14-2012 So basically what you did was copy UsedKeyOnDoor. This caused the script to have the same function 2 times, with the same name. When you use the key on the door the script doesn't know which function to execute, which causes the error. But even if the script would work, it would open the same door with the same key all the time. So what you have to do is: Code: //////////////////////////// Create 2 mansion doors, called mansion_1 and mansion_2. With key_1 you can open mansion_1 and with key_2 mansion_2. Important: It has to be key_1 and not Key_1! C++ is case-sensitive. RE: Keys and Doors - tehwhynot - 10-14-2012 Man you are the best now i can finally make my custom story and i have anhoter question how can i add a description and a name to a key? RE: Keys and Doors - The chaser - 10-14-2012 This should be useful for you: http://wiki.frictionalgames.com/hpl2/tutorials/script/scripting_by_xtron_-_item_that_unlocks_a_door?s[]=key RE: Keys and Doors - tehwhynot - 10-14-2012 yeah i watch that but it didnt explain how to make for more doors and didnt show how to describe and name the keys. And i want to describe and name the key. RE: Keys and Doors - Ongka - 10-14-2012 Open your custom story folder, create a textfile called extra_english.lang and open it with a text editor. Now insert this code: Code: <LANGUAGE> |