Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Amnesia script help
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#1
Amnesia script help

So im tryng to make TWO keys open ONE door but only nailed it with one so far Smile
Any suggestions???
08-29-2014, 04:29 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
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
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#3
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
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.
(This post was last modified: 08-29-2014, 04:50 PM by FlawlessHappiness.)
08-29-2014, 04:48 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#5
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
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
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#7
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
Find




Users browsing this thread: 1 Guest(s)