Frictional Games Forum (read-only)
Key to door Script 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Key to door Script help (/thread-7024.html)

Pages: 1 2


Key to door Script help - ZxBrad - 03-23-2011

Im making a little test migjigger.
And I have a door and a key on my lvl editor and i want the key to open that specific door, it works its just the name of the key doesnt pop up, it just says
"Picked Up"

And when i use it on the door the key doesnt go away. here is the script

Quote:////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "castle_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("awesomekey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

o and here is my extra english

Quote:<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Just a brief description!</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<EntryName="ItemName_awesomekey_1">Awesome Key</Entry>
<Entry Name="ItemDesc_awesomekey_1">Key to your moms bedroom</Entry>
</CATEGORY>
</LANGUAGE>



RE: Key to door Script help - palistov - 03-23-2011

Select the item in the editor suite, and go to the next tab. At the bottom there is an Item Category box and an Item Name box, make sure you input "awesomekey_1" in both fields. Make sure the key's name in the editor is also awesomekey_1.


RE: Key to door Script help - ZxBrad - 03-23-2011

(03-23-2011, 08:23 PM)palistov Wrote: Select the item in the editor suite, and go to the next tab. At the bottom there is an Item Category box and an Item Name box, make sure you input "awesomekey_1" in both fields. Make sure the key's name in the editor is also awesomekey_1.

Thx but that didnt work. It still gives me
"Picked Up"

But it did make the key go away when i use it


RE: Key to door Script help - Viperdream - 03-23-2011

You have to start the custom story from the main menu, not load it in the debug menu. Because if you do that, you won't see those names from the .lang file


RE: Key to door Script help - ZxBrad - 03-23-2011

(03-23-2011, 08:58 PM)Viperdream Wrote: You have to start the custom story from the main menu, not load it in the debug menu. Because if you do that, you won't see those names from the .lang file

I dont play on debug mode. It justs doesnt work. I suck at this lol


RE: Key to door Script help - MrBigzy - 03-23-2011

Nah, I'm having the same problem right now, trying to fix it.


RE: Key to door Script help - Russ Money - 03-24-2011

I have a similar script for my mod, I'll post it here, maybe it'll help you out.
Code:
void OnStart()
{
AddUseItemCallback("hallwaydoorunlocked", "HallwayKey", "sewer_arched_4", "hallwaydoorunlocked", true);
}

void hallwaydoorunlocked(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("sewer_arched_4", false, false);
RemoveItem("HallwayKey");
PlaySoundAtEntity("unlocking", "unlock_door.snt", "Player", 0, false);
}

And the .lang file for this category:
Code:
<CATEGORY Name="Inventory">

<Entry Name="ItemName_HallwayKey">Hallway Key</Entry>
<Entry Name="ItemDesc_HallwayKey">A key for the main hall.</Entry>

</CATEGORY>

As for the key you pick up, the name of the entity is "HallwayKey"
and the CustomSubItemTypeName is also "HallwayKey"

All this considered, my custom story is working properly.

edit: Also, I believe having underscores in the item name may not let it read properly, try changing the item name and desc to:

<EntryName="ItemName_awesomekey1">Awesome Key</Entry>
<Entry Name="ItemDesc_awesomekey1">Key to your moms bedroom</Entry>


RE: Key to door Script help - Austums - 03-24-2011

(03-24-2011, 01:02 AM)Russ Money Wrote: I have a similar script for my mod, I'll post it here, maybe it'll help you out.
Code:
void OnStart()
{
AddUseItemCallback("hallwaydoorunlocked", "HallwayKey", "sewer_arched_4", "hallwaydoorunlocked", true);
}

void hallwaydoorunlocked(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("sewer_arched_4", false, false);
RemoveItem("HallwayKey");
PlaySoundAtEntity("unlocking", "unlock_door.snt", "Player", 0, false);
}

And the .lang file for this category:
Code:
<CATEGORY Name="Inventory">

<Entry Name="ItemName_HallwayKey">Hallway Key</Entry>
<Entry Name="ItemDesc_HallwayKey">A key for the main hall.</Entry>

</CATEGORY>

As for the key you pick up, the name of the entity is "HallwayKey"
and the CustomSubItemTypeName is also "HallwayKey"

All this considered, my custom story is working properly.

edit: Also, I believe having underscores in the item name may not let it read properly, try changing the item name and desc to:

<EntryName="ItemName_awesomekey1">Awesome Key</Entry>
<Entry Name="ItemDesc_awesomekey1">Key to your moms bedroom</Entry>

I just tried your script and none of the things in my extra_english file are showing up now >_>

EDIT: Nevermind, the CustomSubItemTypeName was blank, testing now
Still not working. Here's my script for the key.

Code:
<CATEGORY Name="Inventory">

<Entry Name="ItemName_keystudy1">Living Quarters Key</Entry>
<Entry Name="ItemDesc_keystudy1">A key to the living quarters.</Entry>

</CATEGORY>

All the info on my key:

Name: keystudy1
Active: True
CustomSubItemTypeName: keystudy1


RE: Key to door Script help - Russ Money - 03-24-2011

Then, quite honestly, I am stumped. Sad


RE: Key to door Script help - Austums - 03-24-2011

I just think it is so odd that both me and OP are both having this problem. O_o