Frictional Games Forum (read-only)

Full Version: Need help with key sais error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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");

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

}
You don't have to write asItem and asEntity if you are not using them as string variables.
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 Smile
(03-01-2012, 07:01 AM)Juby Wrote: [ -> ]
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 Smile
Wouldn't it be


SetSwingDoorLocked(asEntity, false, true);
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);
}
Ah, didn't read that.
(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 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.
void 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
Thanks guys so much it works now Big Grin