theodorg
Junior Member
Posts: 44
Threads: 11
Joined: Aug 2013
Reputation:
0
|
Amnesia script help
So im tryng to make TWO keys open ONE door but only nailed it with one so far
Any suggestions???
|
|
08-29-2014, 04:29 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Amnesia script help
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.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
08-29-2014, 04:34 PM |
|
theodorg
Junior Member
Posts: 44
Threads: 11
Joined: Aug 2013
Reputation:
0
|
RE: Amnesia script help
(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:44 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Amnesia script help
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.
Trying is the first step to success.
|
|
08-29-2014, 04:48 PM |
|
theodorg
Junior Member
Posts: 44
Threads: 11
Joined: Aug 2013
Reputation:
0
|
RE: Amnesia script help
(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:13 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Amnesia script help
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
Trying is the first step to success.
|
|
08-29-2014, 05:20 PM |
|
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
|
RE: Amnesia script help
For a swing door.
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
For a level door.
SetLevelDoorLocked(string& asName, bool abLocked);
Derp.
|
|
08-29-2014, 05:20 PM |
|
|