Need help with key sais error - 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: Need help with key sais error (/thread-13669.html) |
Need help with key sais error - swapinamnesia - 02-29-2012 Hi im trying to make my first amnesia map i did a map with a key and a door that was locked but when i try to load the map in amnesia this error pops up FATAL ERROR FATAL ERROR: Could not load script file custom_stories/TheHauntedCellar/maps/TheHauntedCellar.hps! main (13,16) : ERR : Key_1 is not declared What does that mean??? and heres my script in the hps file void OnStart() { AddUseItemCallback("", "Key_1", "door_1", "UsedKeyOnDoor", true); } void FUNCTION(string &in item, string &in door) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem(Key_1); } Could anyone help me have been searching on youtube and google for a solution but i cant find any please help. RE: Need help with key sais error - Tanshaydar - 03-01-2012 void FUNCTIONUsedKeyOnDoor(string &in item, string &in door) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem(Key_1 "Key_1"); } RE: Need help with key sais error - Obliviator27 - 03-01-2012 void FUNCTIONUsedKeyOnDoor(string &in item, string &in door)(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem(Key_1 "Key_1"); } RE: Need help with key sais error - Tanshaydar - 03-01-2012 You don't have to write asItem and asEntity if you are not using them as string variables. RE: Need help with key sais error - Juby - 03-01-2012 My personal favorite way to do this:
void UsedKeyOnDoor(string &in Item, string &in Door)
{ SetSwingDoorLocked(Door, false, true); PlaySoundAtEntity("", "unlock_door", Door, 0, false); RemoveItem(Item); } so you can use it multiple times RE: Need help with key sais error - flamez3 - 03-01-2012 (03-01-2012, 07:01 AM)Juby Wrote:Wouldn't it be SetSwingDoorLocked(asEntity, false, true);
RE: Need help with key sais error - Tanshaydar - 03-01-2012 It wouldn't be because: void UsedKeyOnDoor(string &in Item, string &in Door) { SetSwingDoorLocked(Door, false, true); PlaySoundAtEntity("", "unlock_door", Door, 0, false); RemoveItem(Item); } RE: Need help with key sais error - flamez3 - 03-01-2012 Ah, didn't read that. RE: Need help with key sais error - jessehmusic - 03-01-2012 (02-29-2012, 11:48 PM)swapinamnesia Wrote: Hi im trying to make my first amnesia map i did a map with a key and a door that was locked but when i try to load the map in amnesia this error pops upvoid OnStart() { AddUseItemCallback("", "Key_1", "door_1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in item, string &in door) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem(Key_1); } try this RE: Need help with key sais error - swapinamnesia - 03-02-2012 Thanks guys so much it works now |