Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
** SOLVED ** Key Doesn't Unlock Door!
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#1
Wink  ** 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
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#2
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.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
05-01-2013, 12:26 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: Key Doesn't Unlock Door!

Door unlock.
PHP Code: (Select All)
void OnStart()

    
AddUseItemCallback("""Key1""masion_Door""DoorUnlockKey"true);
}

void OnEnter()
{

}

void OnLeave()


}
void DoorUnlockKey(string &in asItemstring &in asEntity//Syntax mistake.
{
    
SetLevelDoorLocked("masion_Door"false);
    
PlayGuiSound("unlock.door.snt"100);
    
RemoveItem("KeyNAME");


extra_english.lang
PHP Code: (Select All)
<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."
(This post was last modified: 05-01-2013, 12:36 PM by PutraenusAlivius.)
05-01-2013, 12:36 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#4
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
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#5
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.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
05-01-2013, 12:54 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#6
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
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#7
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)

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
05-01-2013, 01:05 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#8
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
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#9
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.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
05-01-2013, 01:12 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#10
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
Find




Users browsing this thread: 1 Guest(s)