FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
** SOLVED ** Key Doesn't Unlock Door!
I created a key, but the key doesn't unlock the door. Here are my files.
HPS FILE: (I know "masion_Door" is spelt wrong)
void OnStart()
{
AddUseItemCallback("", "Key1", "masion_Door", "FUNCTION", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
void FUNCTION(string &in item, string &in door)
{
SetLevelDoorLocked("masion_Door", false);
PlayGuiSound("unlock.door.snt", 100);
RemoveItem("item");
}
My extra_english.lang:
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Dare to enter the castle tombs...</Entry>
</CATEGORY>
<CATEGORY Name="Messages">
<Entry Name="doorlock1">No need to go back outside...</Entry>
</CATEGORY>
</LANGUAGE>
My key name and door name match the names they have inside the editor.
(This post was last modified: 05-01-2013, 01:46 PM by FurtherGames.)
|
|
05-01-2013, 12:14 PM |
|
DeAngelo
Senior Member
Posts: 263
Threads: 26
Joined: Feb 2013
Reputation:
11
|
RE: Key Doesn't Unlock Door, No Desc or Key Name?
Two things:
Your Lang problem is highlighted in red here:
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Dare to enter the castle tombs...</Entry>
</CATEGORY>
<CATEGORY Name="Messages">
<Entry Name="doorlock1">No need to go back outside...</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_Key1">room key</Entry>
<Entry Name="ItemDesc_Key1">The key for my room.</Entry>
</CATERGORY>
</LANGUAGE>
and your key not unlocking your door, the problem is highlighted in red here:
void OnStart()
{
AddUseItemCallback("item", "Key1", "masion_Door", "FUNCTION", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("masion_Door", false);
PlayGuiSound("unlock.door.snt", 100);
RemoveItem("item");
}
Make those changes and it should work. Oh and the "item" in your RemoveItem at the end should be changed to RemoveItem("Key1"); if you're wanting it to remove the key that unlocked the door. Unless you actually have an item named "item" it won't work.
|
|
05-01-2013, 12:26 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Key Doesn't Unlock Door!
Door unlock.
void OnStart() { AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true); }
void OnEnter() {
}
void OnLeave() {
} void DoorUnlockKey(string &in asItem, string &in asEntity) //Syntax mistake. { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("KeyNAME"); }
extra_english.lang
<LANGUAGE> <RESOURCES> </RESOURCES> <CATEGORY Name="CustomStoryMain"> <Entry Name="Description">Dare to enter the castle tombs...</Entry> </CATEGORY> <CATEGORY Name="Messages"> <Entry Name="doorlock1">No need to go back outside...</Entry> </CATEGORY> <CATEGORY Name="Inventory"> <Entry Name="ItemName_KeyNAME">KeyName</Entry> <Entry Name="ItemDesc_KeyNAME">KeyDesc</Entry> </CATEGORY> </LANGUAGE>
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-01-2013, 12:36 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Key Doesn't Unlock Door!
My key still doesn't unlock the door. I didn't copy the //Syntax mistake. because I didn't think it was needed.
Here is my HPS file:
void OnStart()
{
AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
void DoorUnlockKey(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("masion_Door", false);
PlayGuiSound("unlock.door.snt", 100);
RemoveItem("item");
}
|
|
05-01-2013, 12:49 PM |
|
DeAngelo
Senior Member
Posts: 263
Threads: 26
Joined: Feb 2013
Reputation:
11
|
RE: Key Doesn't Unlock Door!
Are you sure the key and door are named exactly as shown in your HPS? Sometimes even upper case and lower case makes a difference.
|
|
05-01-2013, 12:54 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Key Doesn't Unlock Door!
(05-01-2013, 12:54 PM)DeAngelo Wrote: Are you sure the key and door are named exactly as shown in your HPS? Sometimes even upper case and lower case makes a difference.
Yes, I assure you. Inside the level editor:
Key name: Key1
Door name: maison_Door
(I know this is spelt wrong)
I copied them from the level editor to the HPS File.
HPS File:
void OnStart()
{
AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
void DoorUnlockKey(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("masion_Door", false);
PlayGuiSound("unlock.door.snt", 100);
RemoveItem("Key1");
}
|
|
05-01-2013, 01:02 PM |
|
DeAngelo
Senior Member
Posts: 263
Threads: 26
Joined: Feb 2013
Reputation:
11
|
RE: Key Doesn't Unlock Door!
You put that in the level editor it's maison_Door but in your script it's masion_Door (the i and s are switched)
|
|
05-01-2013, 01:05 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Key Doesn't Unlock Door!
(05-01-2013, 01:05 PM)DeAngelo Wrote: You put that in the level editor it's maison_Door but in your script it's masion_Door (the i and s are switched)
Sorry, that was my own typing mistake. It is masion_Door in both the HPS File and the Level Editor.
ONCE AGAIN, MY HPS FILE
void OnStart()
{
AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
void DoorUnlockKey(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("masion_Door", false);
PlayGuiSound("unlock.door.snt", 100);
RemoveItem("Key1");
}
(This post was last modified: 05-01-2013, 01:10 PM by FurtherGames.)
|
|
05-01-2013, 01:09 PM |
|
DeAngelo
Senior Member
Posts: 263
Threads: 26
Joined: Feb 2013
Reputation:
11
|
RE: Key Doesn't Unlock Door!
This is probably a dumb question, but are you sure that your door is a level door and not just a regular swing door? Barring that, it may be best to just upload your level in a zip so that someone can take a look hands on at the level and the HPS file.
|
|
05-01-2013, 01:12 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Key Doesn't Unlock Door!
(05-01-2013, 01:12 PM)DeAngelo Wrote: This is probably a dumb question, but are you sure that your door is a level door and not just a regular swing door? Barring that, it may be best to just upload your level in a zip so that someone can take a look hands on at the level and the HPS file.
It's a swing door that isn't unlocking.
|
|
05-01-2013, 01:14 PM |
|
|