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
Doors unlocked after picking up the key?
Darkdevil725 Offline
Junior Member

Posts: 5
Threads: 2
Joined: Oct 2011
Reputation: 0
#1
Doors unlocked after picking up the key?

My doors were working just fine this morning but after adding some scripting now my doors unlock as soon as I pick up there respective keys rather than waiting till I use them. I check the scripting and nothing has changed. Thats the script, what is wrong?

void OnStart()
{
}

void OnEnter()
{
AddUseItemCallback("", "Study_Closet_Key", "Study_Closet", "KeyOnDoor", true);
AddUseItemCallback("", "hallway_key_1", "hallway_door_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "hallway_door_slam_1", "func_slam", true, 1);
SetEntityPlayerInteractCallback("mansion_4", "func_slam", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Study_Closet", false, true);
PlaySoundAtEntity("", "unlock_door", "Study_Closet", 0, false);
RemoveItem("Study_Closet_Key");
SetSwingDoorLocked("hallway_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "hallway_door_1", 0, false);
RemoveItem("hallway_key_1");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("hallway_door_2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

void func_slam(string &in asEntity)
{
SetPropHealth("mansion_4", 0.0f);


PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);


PlaySoundAtEntity("", "react_scare", "Player", 0, false);


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);


GiveSanityDamage(5.0f, true);
}


void OnLeave()
{
}
10-17-2011, 05:16 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Doors unlocked after picking up the key?

Your script shows that unlocking one door unlocks both doors, but it doesn't show that they unlock when picking up a key.

Tutorials: From Noob to Pro
10-17-2011, 05:31 AM
Website Find
Darkdevil725 Offline
Junior Member

Posts: 5
Threads: 2
Joined: Oct 2011
Reputation: 0
#3
RE: Doors unlocked after picking up the key?

(10-17-2011, 05:31 AM)Your Computer Wrote: Your script shows that unlocking one door unlocks both doors, but it doesn't show that they unlock when picking up a key.
Where are you seeing that at and what alterations should I make to fix it?
10-17-2011, 05:33 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Doors unlocked after picking up the key?

(10-17-2011, 05:33 AM)Darkdevil725 Wrote: Where are you seeing that at and what alterations should I make to fix it?

Replace this:
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Study_Closet", false, true);
PlaySoundAtEntity("", "unlock_door", "Study_Closet", 0, false);
RemoveItem("Study_Closet_Key");
SetSwingDoorLocked("hallway_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "hallway_door_1", 0, false);
RemoveItem("hallway_key_1");
}

With:
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}

Tutorials: From Noob to Pro
10-17-2011, 05:41 AM
Website Find
Darkdevil725 Offline
Junior Member

Posts: 5
Threads: 2
Joined: Oct 2011
Reputation: 0
#5
RE: Doors unlocked after picking up the key?

THANKS!
10-17-2011, 05:56 AM
Find




Users browsing this thread: 2 Guest(s)