Viuffuz
Junior Member
Posts: 13
Threads: 4
Joined: Jan 2012
Reputation:
0
|
Help with a locked doors!
I have two locked doors in the same level and when I open the first door with a key, it opens the other door at the same time. Why does this happen?
Here's the script!
void OnStart ()
{
AddUseItemCallback("", "Avain", "mansion_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "pihan_avain", "mansion_11", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("Avain");
SetSwingDoorLocked("mansion_11", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_11", 0, false);
RemoveItem("pihan_avain")
}
|
|
04-23-2012, 07:23 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help with a locked doors!
You should put bracket between the removeitem and setswingdoor locked
because if they are in the same they will both open.Try this:
void OnStart ()
{
AddUseItemCallback("", "Avain", "mansion_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "pihan_avain", "mansion_11", "UsedKeyOnDoor2", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("Avain");
}
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_11", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_11", 0, false);
RemoveItem("pihan_avain")
}
(This post was last modified: 04-23-2012, 07:36 PM by Datguy5.)
|
|
04-23-2012, 07:35 PM |
|
overscore
Junior Member
Posts: 10
Threads: 1
Joined: Apr 2012
Reputation:
1
|
RE: Help with a locked doors!
Giving the keys and doors unique names will help with that problem. As shown above.
|
|
04-23-2012, 08:02 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: Help with a locked doors!
If YourComputer was here, he would frown.
Just do this:
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
|
|
04-23-2012, 08:13 PM |
|
Viuffuz
Junior Member
Posts: 13
Threads: 4
Joined: Jan 2012
Reputation:
0
|
RE: Help with a locked doors!
Thanks Datguy5! It helped!
|
|
04-23-2012, 08:15 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help with a locked doors!
(04-23-2012, 08:15 PM)Viuffuz Wrote: Thanks Datguy5! It helped!
Np glad that i could help.
|
|
04-24-2012, 05:34 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Help with a locked doors!
The problem was that both of your scripts were called void UsedKeyOnDoor
Datguy5 called one of them UsedKeyOnDoor2. And also edited in the
void OnStart script
Just so it won't happen again
Trying is the first step to success.
|
|
04-24-2012, 07:07 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: Help with a locked doors!
(04-24-2012, 07:07 PM)beecake Wrote: The problem was that both of your scripts were called void UsedKeyOnDoor
Datguy5 called one of them UsedKeyOnDoor2. And also edited in the
void OnStart script
Just so it won't happen again Dude, just use my script. It's half the size, and you can use it for 50 doors if you want.
(This post was last modified: 04-24-2012, 07:15 PM by Cranky Old Man.)
|
|
04-24-2012, 07:15 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help with a locked doors!
The problem is already solved.No need to fight about it nuff said.
|
|
04-24-2012, 07:37 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: Help with a locked doors!
(04-24-2012, 07:37 PM)Datguy5 Wrote: The problem is already solved.No need to fight about it nuff said. I'm not "fighting you". I'm talking about using efficient code. Would there be a woman involved somewhere, then I could possibly fight you, but there's no point in "fighting" on these forums.
|
|
04-24-2012, 08:22 PM |
|
|