Frictional Games Forum (read-only)
[help]Key wont unlock door - 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: [help]Key wont unlock door (/thread-10938.html)



[help]Key wont unlock door - Lemorz56 - 10-23-2011

Hello, Ive made a map with a door and a key, when i use the key on the door it says "Cannot Use Item This Way". heres my .hps file. (ALSO the key's (one key) name is "monsterdoorkey" and the door "monsterdoor")
Code:
void OnStart()
{
AddUseItemCallback("", "monsterdoorkey", "monsterdoor", "LockFunction", true);
}

void LockFunction(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("monsterdoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
    RemoveItem("monsterdoorkey1");
}

And heres my lang file
Code:
<LANGUAGE>
       <CATEGORY Name="CustomStoryMain">
          <Entry Name="Description">This is an story and a little remake of Martin's AKA "Marwin" House. Have FUN!.[br]Thank You For Playing And Downloading This Map![br]support me at youtube Z3bProductions[br]Also bring an extra pairofpants! HEHEH</Entry>
       </CATEGORY>
      
     <CATEGORY Name="Inventory">
       <Entry Name="ItemDesc_monsterdoorkey">Key To Hallway</Entry>
       <Entry Name="ItemName_monsterdoorkey">Hallway Key</Entry>
     </CATEGORY>
      
</LANGUAGE>


also anyone who knows how to make a note/text appear on pickup?


RE: [help]Key wont unlock door - Unearthlybrutal - 10-23-2011

In level editor:


1. click the key
2. click entity from keys properties
3. there is "CallbackFunc", write there "useexit"
4. there is also "CustomSubItemTypeName", write there "monsterdoorkey" <--(this is for .lang file)




copy that to your hps file
Spoiler below!


void OnStart()
{
AddUseItemCallback("useexit", "monsterdoorkey", "monsterdoor", "UsedKeyOnDoor", true);
}



void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor", 0.0f, false);
RemoveItem("monsterdoorkey");
}







RE: [help]Key wont unlock door - Lemorz56 - 10-23-2011

(10-23-2011, 11:49 AM)Unearthlybrutal Wrote: In level editor:


1. click the key
2. click entity from keys properties
3. there is "CallbackFunc", write there "useexit"
4. there is also "CustomSubItemTypeName", write there "monsterdoorkey" <--(this is for .lang file)




copy that to your hps file
Spoiler below!


void OnStart()
{
AddUseItemCallback("useexit", "monsterdoorkey", "monsterdoor", "UsedKeyOnDoor", true);
}



void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor", 0.0f, false);
RemoveItem("monsterdoorkey");
}




THANK U OMG OMG, Also my spotlight wont emit ligt :S and is there a tutorial for notes?


RE: [help]Key wont unlock door - Unearthlybrutal - 10-23-2011


In lever editor:

1. click the note
2. click entity from notes properties

3. there is "NoteText", write there "Test1" like in .lang file


Copy this to your .lang file
Spoiler below!


<CATEGORY Name="Journal">
<Entry Name="Note_Test1_Name">The title of your note</Entry>
<Entry Name="Note_Test1_Text">The text of your note</Entry>
</CATEGORY>



Got it? Smile