This group contains the add-ons for the game Amnesia: The Dark Descent from Ukrainian developers of models. You can download, comment on it. At this period in the development group.

Report article RSS Feed Amnesia - Key Quest

A tutorial about how you create a simple key quest in Amnesia level editor.

Posted by ☣Kaernk☣ on Jan 6th, 2013
Basic Mapping/Technical.

Let's do a simple key quest.
A key can be found in the "items" folder in "entities" in the level editor. Name your key into anything you want. To make it simple, I named it "key". Then add a door and name it as well. I decided to call it "door". This is the command we are going to work with. "AddUseItemCallback"   AddUseItemCallback("","key","door","UsedKeyOnDoor",true);    Leave the first option blank, it's not needed unless you are doing advanced scriptings. The second field is the name of the item (key). The third field is the name of the object you want to use the item on (door). And the last field is what you want to call the Callback. The Callback is what you want the game to do once the item have been used on the object. The command is called "void UsedKeyOnDoor"  You can call the void anything. But I decided to call it "UsedKeyOnDoor" to make it simple.

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door",false, true);
PlaySoundAtEntity("","unlock_door","door", 0,false);
RemoveItem("key");
}

SetSwingDoorLocked means the door is locked and we want to unlock it with the key. First field is the name of the door (door) and the second field is if you want the door to be locked or unlocked. "false" means it wont be locked. "true" means it will be locked.   The thrid field is nothing you have to care about. Just let it be "true".
PlaySoundAtEntity is the sound we want to play when you unlock the door. First field is the "internal name". Only needed for more advanced scriptings. Leave it blank.   The second field is the name of the sound file. "unlock_door" is the classical sound played while unlocking doors. I recommend you to leave it that way.   The third field is where you want it to sound. Same name as the object (door) is recommended. The fourth field is how long time it will take for the sound to fade. "0" is most realistic in this case. And the last field is if you want the sound to be able to loop or not. We only want it to play once so let it be "false".
RemoveItem is the item we want to remove once you have used the item on the door. The key in this case. The player will move around with a key he wont need anymore otherwise. RemoveItem(name of the item)

This is how it will look like once it's done 

void OnStart()

AddUseItemCallback("","key","door","UsedKeyOnDoor",true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door",false, true);
PlaySoundAtEntity("","unlock_door","door", 0,false);
RemoveItem("key");
}

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Established
Dec 23, 2011
Privacy
Public
Subscription
Open to all members
Contact
Send Message
Email
Members Only
Membership
Join this group
Group Watch
Track this group
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Games
Amnesia: The Dark Descent
Amnesia: The Dark Descent Indie Single Player Adventure
Related Groups
Amnesia Modders
Amnesia Modders Hobbies & Interests group with 332 members
Amnesia: The Dark Descent addons (UA)
Amnesia: The Dark Descent addons (UA) Hobbies & Interests group with 13 members