Frictional Games Forum (read-only)

Full Version: Key to door Script help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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>
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.
(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
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
(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
Nah, I'm having the same problem right now, trying to fix it.
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>
(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
Then, quite honestly, I am stumped. Sad
I just think it is so odd that both me and OP are both having this problem. O_o
Pages: 1 2