Frictional Games Forum (read-only)
[SCRIPT] Key and door problem - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Key and door problem (/thread-12235.html)



Key and door problem - TheMadmaxster - 01-01-2012

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?




RE: Key and door problem - flamez3 - 01-01-2012

(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");


RE: Key and door problem - TheMadmaxster - 01-01-2012

(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?




RE: Key and door problem - flamez3 - 01-01-2012

(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");



RE: Key and door problem - TheMadmaxster - 01-01-2012

(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?




RE: Key and door problem - flamez3 - 01-01-2012

(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.





RE: Key and door problem - TheMadmaxster - 01-01-2012

(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




RE: Key and door problem - flamez3 - 01-01-2012

Is it named door_1 in the level editor?


RE: Key and door problem - TheMadmaxster - 01-01-2012

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