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
-Simple- key open door
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#1
-Simple- key open door

I dunno how to get a key to open a door. How do I do this.

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-23-2012, 09:00 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: -Simple- key open door

Fun with scripting! Assuming you have a basic understanding of how to write scripts, it will need to look like this:


void OnStart()
{
AddUseItemCallback("", "NAMEOFKEY", "NAMEOFDOOR", "NAMEOFFUNCTION", true);
}

void NAMEOFFUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("NAMEOFDOOR", false, true);
RemoveItem("NAMEOFKEY");
}

If you already have an OnStart function in your script, add the "AddUseItemCallback" to it.
NAMEOFKEY - Replace with the name of your key

NAMEOFDOOR - Replace with the name of your door

NAMEOFFUNCTION - Can be named anything you'd like

I rate it 3 memes.
06-23-2012, 09:12 AM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#3
RE: -Simple- key open door

It keeps saying Item cannot be used this way.

This is what I have:


void OnStart()
{
AddUseItemCallback("", "key1", "door1", "OpenS", true);
}

void OpenS(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
RemoveItem("key1");
}

See anything wrong?

Keyname: key1
Doorname: door1

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-23-2012, 09:59 AM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#4
RE: -Simple- key open door

(06-23-2012, 09:12 AM)andyrockin123 Wrote: Fun with scripting! Assuming you have a basic understanding of how to write scripts, it will need to look like this:


void OnStart()
{
AddUseItemCallback("", "NAMEOFKEY", "NAMEOFDOOR", "NAMEOFFUNCTION", true);
}

void NAMEOFFUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("NAMEOFDOOR", false, true);
RemoveItem("NAMEOFKEY");
}

If you already have an OnStart function in your script, add the "AddUseItemCallback" to it.
NAMEOFKEY - Replace with the name of your key

NAMEOFDOOR - Replace with the name of your door

NAMEOFFUNCTION - Can be named anything you'd like
Y U NO Play sound at entity? Tongue

Anyways Andy, I've had a goddamned problem ever since i couldn't get that closet open with a crowbar, I can't make a key unlock a door no matter every right thing i do Huh

Hi.
(This post was last modified: 06-23-2012, 11:09 AM by MaZiCUT.)
06-23-2012, 11:07 AM
Website Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#5
RE: -Simple- key open door

(06-23-2012, 11:07 AM)CrazyArts Wrote:
(06-23-2012, 09:12 AM)andyrockin123 Wrote: Fun with scripting! Assuming you have a basic understanding of how to write scripts, it will need to look like this:


void OnStart()
{
AddUseItemCallback("", "NAMEOFKEY", "NAMEOFDOOR", "NAMEOFFUNCTION", true);
}

void NAMEOFFUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("NAMEOFDOOR", false, true);
RemoveItem("NAMEOFKEY");
}

If you already have an OnStart function in your script, add the "AddUseItemCallback" to it.
NAMEOFKEY - Replace with the name of your key

NAMEOFDOOR - Replace with the name of your door

NAMEOFFUNCTION - Can be named anything you'd like
Y U NO Play sound at entity? Tongue

Anyways Andy, I've had a goddamned problem ever since i couldn't get that closet open with a crowbar, I can't make a key unlock a door no matter every right thing i do Huh
ME TO

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-23-2012, 12:04 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: -Simple- key open door

Have you checked the file name of the HPS file to see if it matches the file name of the MAP file?

Tutorials: From Noob to Pro
06-23-2012, 12:28 PM
Website Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#7
RE: -Simple- key open door

(06-23-2012, 12:28 PM)Your Computer Wrote: Have you checked the file name of the HPS file to see if it matches the file name of the MAP file?
Ofcourse i have, i have checked everything.

Heck, desperately i've even copied the script from another custom story to see if it works, still no.

Hi.
06-23-2012, 12:31 PM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#8
RE: -Simple- key open door

Did you make an hps file by renaming a text file .hps? I'm pretty sure that doesn't work; you need an hps file template to work with.

I rate it 3 memes.
06-23-2012, 12:35 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#9
Wink  RE: -Simple- key open door

(06-23-2012, 12:35 PM)andyrockin123 Wrote: Did you make an hps file by renaming a text file .hps? I'm pretty sure that doesn't work; you need an hps file template to work with.
How do I get a hps file template?

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-23-2012, 12:46 PM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#10
RE: -Simple- key open door

(06-23-2012, 12:35 PM)andyrockin123 Wrote: Did you make an hps file by renaming a text file .hps? I'm pretty sure that doesn't work; you need an hps file template to work with.
I've got that alredy! It's the same problem with the closet, Cannot use item this way. Dammit this is slowing down my development every day Sad

Hi.
06-23-2012, 12:49 PM
Website Find




Users browsing this thread: 1 Guest(s)