08-29-2014, 04:29 PM
08-29-2014, 04:34 PM
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:44 PM
(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!
08-29-2014, 04:48 PM
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.
{
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, 05:13 PM
(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.
08-29-2014, 05:20 PM
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
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
08-29-2014, 05:20 PM
For a swing door.
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
For a level door.
SetLevelDoorLocked(string& asName, bool abLocked);
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
For a level door.
SetLevelDoorLocked(string& asName, bool abLocked);