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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Key and door problem
TheMadmaxster Offline
Junior Member

Posts: 18
Threads: 7
Joined: Jan 2012
Reputation: 0
#1
Key and door problem

Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Discription">Hope you enjoy! </Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_key_1">Study Door Key</Entry>
<Entry Name="ItemDesc_key_1">A key for the Study.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_theletter_Name">Dear Floreze</Entry>
<Entry Name="Note_theletter_Text">Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_Note_Name">Stop!</Entry>
<Entry Name="Note_Note_Text">Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!</Entry>
</CATEGORY>
</LANGUAGE>

Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?

(This post was last modified: 01-01-2012, 04:32 AM by TheMadmaxster.)
01-01-2012, 04:25 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Key and door problem

(01-01-2012, 04:25 AM)TheMadmaxster Wrote: Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)




Hope you enjoy!


Study Door Key
A key for the Study.


Dear Floreze
Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-


Stop!
Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!


Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?


You named the function "MyFunc" when you stated it was called UsedKeyOnDoor. Change that and it should work.
And you didn't put "" around RemoveItem("key1");

(This post was last modified: 01-01-2012, 04:43 AM by flamez3.)
01-01-2012, 04:42 AM
Find
TheMadmaxster Offline
Junior Member

Posts: 18
Threads: 7
Joined: Jan 2012
Reputation: 0
#3
RE: Key and door problem

(01-01-2012, 04:42 AM)flamez3 Wrote:
(01-01-2012, 04:25 AM)TheMadmaxster Wrote: Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)




Hope you enjoy!


Study Door Key
A key for the Study.


Dear Floreze
Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-


Stop!
Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!


Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?


So I need to change MyFunc to UsedKeyOnDoor?

01-01-2012, 04:46 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Key and door problem

(01-01-2012, 04:46 AM)TheMadmaxster Wrote:
(01-01-2012, 04:42 AM)flamez3 Wrote:
(01-01-2012, 04:25 AM)TheMadmaxster Wrote: Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)




Hope you enjoy!


Study Door Key
A key for the Study.


Dear Floreze
Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-


Stop!
Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!


Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?


So I need to change MyFunc to UsedKeyOnDoor?
Yes, and replace your remove item to this:

RemoveItem("key_1");

01-01-2012, 04:51 AM
Find
TheMadmaxster Offline
Junior Member

Posts: 18
Threads: 7
Joined: Jan 2012
Reputation: 0
#5
RE: Key and door problem

(01-01-2012, 04:51 AM)flamez3 Wrote:
(01-01-2012, 04:46 AM)TheMadmaxster Wrote:
(01-01-2012, 04:42 AM)flamez3 Wrote:
(01-01-2012, 04:25 AM)TheMadmaxster Wrote: Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)




Hope you enjoy!


Study Door Key
A key for the Study.


Dear Floreze
Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-


Stop!
Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!


Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?


It pulled up but there wasnt a name to the key so then I picked it up then tried it on the door and it said it can't be used this way... How do I fix That?

01-01-2012, 04:57 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: Key and door problem

(01-01-2012, 04:57 AM)TheMadmaxster Wrote:
(01-01-2012, 04:51 AM)flamez3 Wrote:
(01-01-2012, 04:46 AM)TheMadmaxster Wrote:
(01-01-2012, 04:42 AM)flamez3 Wrote:
(01-01-2012, 04:25 AM)TheMadmaxster Wrote: Alright, This is my .hps file
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItemA, string &in asItemB)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem(key_1);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This is my .lang file (Ignore the note part)




Hope you enjoy!


Study Door Key
A key for the Study.


Dear Floreze
Dear Floreze,[br] You are truely crazy! I can't belive you. You Take our family rug then try to escape the house![br]Well, now you will pay! I've sent my servents to get you, the dead ones.[br]I may not finish this note, but if I find you I will-


Stop!
Stop!,[br] You can't go in that door, I see you right now! I'm locking the door.[br]I've hidden the key somewhere try finding it now![br]Muahahaha!


Everytime I try to pull up the map it says:
(12,14) ERR: 'key_1' is not declared. How do I fix?


It pulled up but there wasnt a name to the key so then I picked it up then tried it on the door and it said it can't be used this way... How do I fix That?
What's the name of the door you want to unlock.



01-01-2012, 05:47 AM
Find
TheMadmaxster Offline
Junior Member

Posts: 18
Threads: 7
Joined: Jan 2012
Reputation: 0
#7
RE: Key and door problem

(01-01-2012, 05:47 AM)flamez3 Wrote:
(01-01-2012, 04:57 AM)TheMadmaxster Wrote: [quote='flamez3' pid='108184' dateline='1325389860']
[quote='TheMadmaxster' pid='108183' dateline='1325389616']
[quote='flamez3' pid='108180' dateline='1325389345']
door_1

(This post was last modified: 01-01-2012, 06:55 AM by TheMadmaxster.)
01-01-2012, 06:30 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#8
RE: Key and door problem

Is it named door_1 in the level editor?

01-01-2012, 08:32 AM
Find
TheMadmaxster Offline
Junior Member

Posts: 18
Threads: 7
Joined: Jan 2012
Reputation: 0
#9
RE: Key and door problem

(01-01-2012, 08:32 AM)flamez3 Wrote: Yes.

01-01-2012, 06:35 PM
Find




Users browsing this thread: 2 Guest(s)