Frictional Games Forum (read-only)
Of Keys and Locked 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Of Keys and Locked doors... (/thread-6171.html)

Pages: 1 2


Of Keys and Locked doors... - Ethril - 01-12-2011

Hi guys! was wondering if you could help me with some scripting. I have been trying to get a certain locked door to be opened by a key. However, the key doesn't open the door nor will the door stay locked unless I have the box marked "locked", ticked.

Here are my scripts

extra_english.lang file:


<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">(story description)</Entry>
</CATEGORY>


<CATEGORY Name="Journal">
<Entry Name="Note_Test01_Name">Dusty Note</Entry>
<Entry Name="Note_Test01_Text">(note text).</Entry>
</CATEGORY>


<CATEGORY Name="Inventory">
<Entry Name="ItemName_StrangeKey">Strange Key</Entry>
<Entry Name="ItemDesc_StrangeKey">Key for a cellar door.</Entry>
</CATEGORY>

</LANGUAGE>


and here is the HPS:

void onStart()
{
AddUseItemCallback("", "strangekey_1", "cellar_wood01_2", "UsedKeyOnDoor", true);
}

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

void onEnter()
{

}


void OnLeave()
{

}


The key works as intended, when picked up it will say you have picked up strange key and it will show in my inventory along with the description but when used on the door that it is supposed to unlock, it will just not work.

Does anyone know what is wrong with my script Sad?


RE: Of Keys and Locked doors... - Ethril - 01-12-2011

any one Sad?


RE: Of Keys and Locked doors... - Neatherblade - 01-12-2011

void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

Taken from here

http://www.frictionalgames.com/forum/thread-5117.html


RE: Of Keys and Locked doors... - Ethril - 01-12-2011

(01-12-2011, 11:10 AM)Neatherblade Wrote: void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

Taken from here

http://www.frictionalgames.com/forum/thread-5117.html

Ty for the info! however it still will not open with the use of my key. Are there any options on the door and key that I have to put info in? all I have done is ticked the "lock" box on the door entity. I am able to pick up the key see it's name and description however when I double click on it and use it on the door, it says this item can not be used this way!

here is my current script! help please Sad! OldDoor= door name strangekey_1 = key name

void onStart()
{
AddUseItemCallback("", "strangekey_1", "OldDoor", "KeyOnDoor", true);
}


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("OldDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "OldDoor", 0.0f, true);
}



void onEnter()
{

}


void OnLeave()
{

}


RE: Of Keys and Locked doors... - Neatherblade - 01-12-2011

The door you have in the editor is named OldDoor aswell?


RE: Of Keys and Locked doors... - Ethril - 01-12-2011

(01-12-2011, 12:27 PM)Neatherblade Wrote: The door you have in the editor is named OldDoor aswell?

yes, It is a cellar door and I renamed it in the editor as OldDoor

it is marked as active and it is also marked as locked


RE: Of Keys and Locked doors... - Ethril - 01-14-2011

Bump for great justice!


RE: Of Keys and Locked doors... - Frontcannon - 01-14-2011

Work with debug messages to check if the KeyOnDoor function is ever called!


RE: Of Keys and Locked doors... - Ethril - 01-15-2011

(01-14-2011, 08:04 PM)Frontcannon Wrote: Work with debug messages to check if the KeyOnDoor function is ever called!

sorry if this is a stupid question but how do I check debug message hehe Huh


RE: Of Keys and Locked doors... - Andross - 01-15-2011

You need to setup a dev environment as described in this guide and use AddDebugMessage().