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
Can't make a door unlock
jmayo Offline
Junior Member

Posts: 16
Threads: 6
Joined: Sep 2011
Reputation: 0
#1
Can't make a door unlock

I have added something to my map, but when I use the key, it just can't unlock here is the script:

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "doorkey", "startingDoor", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("Starting_Door", false, true);
        PlaySoundAtEntity("", "unlock_door", "startingDoor", 0, false);
        RemoveItem("doorkey");
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}
04-03-2013, 02:24 PM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Can't make a door unlock

The name of the function in the AddUseItemCallback and the function containing the script that unlocks the door is different. Change MyFunc to UsedKeyOnDoor.
EDIT:
BTW, it's void OnStart()

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 04-03-2013, 02:30 PM by PutraenusAlivius.)
04-03-2013, 02:29 PM
Find Reply
Tiger Away
Posting Freak

Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation: 55
#3
RE: Can't make a door unlock

1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section
04-03-2013, 02:44 PM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Can't make a door unlock

(04-03-2013, 02:44 PM)Tigerwub Wrote: 1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section

It's JAP. And obviously you didn't notice my EDIT: part.
Anyway, he's new here. He probably didn't knew that this is the wrong section. Just give the guy an opportunity.

"Veni, vidi, vici."
"I came, I saw, I conquered."
04-03-2013, 02:55 PM
Find Reply
Tiger Away
Posting Freak

Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation: 55
#5
RE: Can't make a door unlock

(04-03-2013, 02:55 PM)JustAnotherPlayer Wrote:
(04-03-2013, 02:44 PM)Tigerwub Wrote: 1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section

It's JAP. And obviously you didn't notice my EDIT: part.
Anyway, he's new here. He probably didn't knew that this is the wrong section. Just give the guy an opportunity.

I saw your edit and I know your name is Jap.
04-03-2013, 04:09 PM
Find Reply




Users browsing this thread: 1 Guest(s)