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


Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to unlock door with key?
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#7
RE: How to unlock door with key?

(12-10-2010, 04:42 AM)house Wrote: It takes years of practicing coding... Just kidding, Here, look at this:

void OnStart()
{
AddUseItemCallback("", "key1", "mansion_1" "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, false);
RemoveItem("key1");
}

mansion_1 is: The name of your door you want to unlock.
key1: The name of the key you want to open the door with.

So now, replace everything from the code above from mansion_1 to the door to unlock, and key1 to the name of the key to use to open the door.

Then copy it into your .hps file for your level!

Okay, but i renamed that "mansion_1" that door but im getting message its already named object somewhere.. then i renamed it "door_1" and "key1" but doesnt work :I

Here: //===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "key1", "door_1" "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0.0f, false);
RemoveItem("key1");
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

This is pissing me off..

“Life is a game, play it”
12-10-2010, 01:53 PM
Find


Messages In This Thread
How to unlock door with key? - by HumiliatioN - 12-09-2010, 10:48 PM
RE: How to unlock door with key? - by Frontcannon - 12-09-2010, 10:57 PM
RE: How to unlock door with key? - by HumiliatioN - 12-09-2010, 11:16 PM
RE: How to unlock door with key? - by Frontcannon - 12-09-2010, 11:25 PM
RE: How to unlock door with key? - by HumiliatioN - 12-09-2010, 11:36 PM
RE: How to unlock door with key? - by house - 12-10-2010, 04:42 AM
RE: How to unlock door with key? - by HumiliatioN - 12-10-2010, 01:53 PM
RE: How to unlock door with key? - by Oscar House - 12-10-2010, 02:29 PM
RE: How to unlock door with key? - by HumiliatioN - 12-11-2010, 12:22 AM
RE: How to unlock door with key? - by LoneWolf - 12-10-2010, 04:12 PM
RE: How to unlock door with key? - by LoneWolf - 12-11-2010, 01:45 AM
RE: How to unlock door with key? - by HumiliatioN - 12-11-2010, 02:18 AM
RE: How to unlock door with key? - by jens - 12-11-2010, 01:06 PM
RE: How to unlock door with key? - by HumiliatioN - 12-11-2010, 04:11 PM
RE: How to unlock door with key? - by Frontcannon - 12-11-2010, 04:54 PM
RE: How to unlock door with key? - by HumiliatioN - 12-11-2010, 05:03 PM
RE: How to unlock door with key? - by Frontcannon - 12-11-2010, 05:22 PM
RE: How to unlock door with key? - by HumiliatioN - 12-11-2010, 05:31 PM
RE: How to unlock door with key? - by Tirilno - 07-06-2011, 10:18 PM
RE: How to unlock door with key? - by Kyle - 07-06-2011, 10:26 PM
RE: How to unlock door with key? - by Tirilno - 07-06-2011, 10:32 PM
RE: How to unlock door with key? - by Zypherzemus - 07-07-2011, 08:36 PM
RE: How to unlock door with key? - by Kyle - 07-08-2011, 01:12 AM
RE: How to unlock door with key? - by Zypherzemus - 07-08-2011, 01:41 AM
RE: how do i do a jump scare - by drumslaya - 09-21-2012, 01:43 PM
RE: How to unlock door with key? - by Robby - 09-21-2012, 02:04 PM
RE: How to unlock door with key? - by GSphoenix - 09-26-2012, 04:18 PM
RE: How to unlock door with key? - by Robby - 09-26-2012, 04:25 PM
RE: How to unlock door with key? - by Statyk - 09-26-2012, 04:23 PM
RE: How to unlock door with key? - by GSphoenix - 09-26-2012, 05:47 PM



Users browsing this thread: 10 Guest(s)