Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
-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!
|
|
06-23-2012, 09:00 AM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
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 |
|
Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
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!
|
|
06-23-2012, 09:59 AM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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?
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
Hi.
(This post was last modified: 06-23-2012, 11:09 AM by MaZiCUT.)
|
|
06-23-2012, 11:07 AM |
|
Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
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?
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 ME TO
Special Custom Story for 2 special people!
|
|
06-23-2012, 12:04 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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?
|
|
06-23-2012, 12:28 PM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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 |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
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 |
|
Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
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!
|
|
06-23-2012, 12:46 PM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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
Hi.
|
|
06-23-2012, 12:49 PM |
|
|