Universal Unlock door with item script - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Universal Unlock door with item script (/thread-6193.html) |
Universal Unlock door with item script - ModManDann - 01-13-2011 As I've been seeing a lot of "how to make a key unlock my door" I've decided to write a small script which unlocks any door with any key. All you need to do is add this piece of code to your map script: Code: void UnlockDoor(string &in asItem, string &in asEntity) and add the following code in the OnEnter() function or the OnStart function: Code: AddUseItemCallback("", "<your key name>","<your door name>", "UnlockDoor", true); You can use the same function for any amount for doors you need to open with keys, so an example level script file: Code: void UnlockDoor(string &in asItem, string &in asEntity) If we run the map of the above example, we would be able to open cellar_door_2 with the key cellar_key_1 and cellar_door_5 with cellar_key_2. The script also works with non-key items, an extreme example: Code: void onEnter() now if we use aggripas_head on cellar_door_5 it will unlock. I hope after this thread there will be less thread posts about "how do I open a door with a key or item" RE: Universal Unlock door with item script - Frontcannon - 01-13-2011 We already have a universal 'key on door'-script somewhere, but let's hope the now stickied script recollection will quell the influx of these posts. |