IMPORTANT: You need to have version 1.3 installed, or the mod will crash for you at some point. If you have the steam version of Amnesia, then the latest version should have installed automatically. You play as Alma, a young girl living with her father somewhere in England. Alma's mother has left the family, and Alma's father has become increasingly hateful towards his daughter. Growing tired of the abusive, Alma decides it's time to do something. For some odd reason, though, Alma is finding notes of events in her life that hasn't happen yet. What is going on?

Report RSS Amnesia - Key Quest

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

Posted by on - 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

Your comment will be anonymous unless you join the community. Or sign in with your social account: