Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
doors problem scirpts
Author Message
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #1
doors problem scirpts
Hello i got a problem with my key and door script Confused
when i have it like this it wont let door be locked
PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""Door key""mansion_1""KeyOnDoor"true); 
AddUseItemCallback("""Old Door key""mansion_5""KeyOnDoor"true); 
}


 
void KeyOnDoor(string &in asItemstring &in asEntity)
 {
     
SetSwingDoorLocked("mansion_1"falsetrue);
     
RemoveItem("Door key");
     
PlaySoundAtEntity("""unlock_door.snt""mansion_1"0.0ftrue);
     
SetSwingDoorLocked("mansion_5"falsetrue);
     
RemoveItem("Old Door key");
     
PlaySoundAtEntity("""unlock_door.snt""mansion_5"0.0ftrue);


If i take that away the doors works to be locked what should i do....

NVM fixed

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 12-25-2011 11:12 PM by jessehmusic.)
12-25-2011 10:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
palistov Offline
Posting Freak

Posts: 1,173
Joined: Mar 2011
Reputation: 56
Post: #2
RE: doors problem scirpts
Your script currently makes both doors unlocked when only one of the keys is used. A simple way you can avoid this is to use an if statement or two to check which door is being unlocked or which key is being used, then run the appropriate lines.

If statements look like this:

PHP Code: (Select All)
if(Condition)
{
//--- do stuff ---//


So check which key/door is being used by doing if(asItem == "Door key") { //etc etc} or if(asEntity == "mansion_1") { // blah blah }

12-26-2011 05:25 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)