Frictional Games Forum (read-only)

Full Version: Amnesia HPL Problem!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
<removed><removed><removed><removed>
The semicolon indicates that a line of code has ended. Therefore you should put it at the end of a line of code rather than at the start. Speaking of which, quotations are needed around Key_1 for RemoveItem.
like what Chronofox said you have to put the ";" in the end of the line and not in front and you forgot to make some { and } so this should work:
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
and you also need quotations for LockedDoor1 and Key_1 which I included in my code.
I hope this helps Big Grin
<removed><removed><removed><removed><removed>
Create a key for each door? Or do you mean you need one key to unlock both doors?
<removed><removed><removed><removed>
void OnStart()
{
AddUseItemCallback("", "Key_2", "LockedDoor2", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}
<removed><removed><removed><removed>
I think you did something worng the last time because this is really just how you do it:
 
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Key_2", "LockedDoor2", "KeyOnDoor", true);
}
 
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
 
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}