Frictional Games Forum (read-only)

Full Version: Amnesia script help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So im tryng to make TWO keys open ONE door but only nailed it with one so far Smile
Any suggestions???
Try using LocalVarInts that increments it's amount by 1 each time you used a key and then have a script to check if the LocalVarInt is 2 or not. If so, unlock the door.
(08-29-2014, 04:34 PM)First Captain Wrote: [ -> ]Try using LocalVarInts that increments it's amount by 1 each time you used a key and then have a script to check if the LocalVarInt is 2 or not. If so, unlock the door.

Am a little new to this so if you could post a script here it would be appreciated!
void OnStart()
{
AddUseItemCallback("", "Key_1", "Door", "DoubleKeyOnDoor", false);
AddUseItemCallback("", "Key_2", "Door", "DoubleKeyOnDoor", false);
}

void DoubleKeyOnDoor(string &in asItem, string &in asEntity)
{
AddLocalVarInt("DoubleDoorVar", 1);
RemoveItem(asItem);

if(GetLocalVarInt("DoubleDoorVar") == 2)
{
SetSwingDoorLocked("Door", false, true);
}
}


There might be mistakes in this script, since I didn't test it. But it should work.
(08-29-2014, 04:48 PM)FlawlessHappiness Wrote: [ -> ]void OnStart()
{
AddUseItemCallback("", "Key_1", "Door", "DoubleKeyOnDoor", false);
AddUseItemCallback("", "Key_2", "Door", "DoubleKeyOnDoor", false);
}

void DoubleKeyOnDoor(string &in asItem, string &in asEntity)
{
AddLocalVarInt("DoubleDoorVar", 1);
RemoveItem(asItem);

if(GetLocalVarInt("DoubleDoorVar") == 2)
{
SetSwingDoorLocked("Door", false, true);
}
}


There might be mistakes in this script, since I didn't test it. But it should work.

Will it make a difference if the door is a level door? Put the script in but nothing happens but a unlock sound i put in when adding the second key.
Yes, it makes a difference.

Because the script line you need to use then is SetLevelDoorLocked and not SetSwingDoorLocked.

You can find all the functions here:
https://wiki.frictionalgames.com/doku.ph..._functions

use Ctrl+F og Cmd+F to search
For a swing door.

SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);

For a level door.

SetLevelDoorLocked(string& asName, bool abLocked);