Frictional Games Forum (read-only)
Key help - 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)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Key help (/thread-18514.html)



Key help - wagiwombledog - 09-26-2012

I'm having a problem getting a key to open a door, can you please help?
waterworks_door=Door
waterworks_key=Key
Here is the script:

void OnStart()
{
AddUseItemCallback("", "waterworks_key", "waterworks_door", "UsedKeyOnDoor", true);
}

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

note: I have more script than this but it is working fine.

Thanks Smile


RE: Key help - Robby - 09-26-2012

Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?


RE: Key help - wagiwombledog - 09-27-2012

(09-26-2012, 08:25 PM)Nemet Robert Wrote: Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?
I don't get an error message on start-up of my CS, but when I use the key on the door it either doesn't unlock, or I get the message "can't use item in this way" or something. Sad


RE: Key help - Mine Turtle - 09-27-2012

(09-27-2012, 05:13 AM)wagiwombledog Wrote:
(09-26-2012, 08:25 PM)Nemet Robert Wrote: Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?
I don't get an error message on start-up of my CS, but when I use the key on the door it either doesn't unlock, or I get the message "can't use item in this way" or something. Sad

make sure you have both the names of the key and the door in the level editor correctly matching. you have to press enter once youve typed in the name of an entity in the level editor, or else it'll go back to default. id check some errors in the script but im out of time atm