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
Keys and Doors
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#4
RE: Keys and Doors

So basically what you did was copy UsedKeyOnDoor.
This caused the script to have the same function 2 times, with the same name.
When you use the key on the door the script doesn't know which function to execute, which causes the error. But even if the script would work, it would open the same door with the same key all the time.
So what you have to do is:
////////////////////////////
//Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "key_2", "mansion_2", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}


void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("key_2");
}
Now you have to create 2 keys, one called key_1 and the other key_2.
Create 2 mansion doors, called mansion_1 and mansion_2.
With key_1 you can open mansion_1 and with key_2 mansion_2.
Important: It has to be key_1 and not Key_1!
C++ is case-sensitive.

[Image: 18694.png]
(This post was last modified: 10-14-2012, 12:57 PM by Ongka.)
10-14-2012, 12:56 PM
Find


Messages In This Thread
Keys and Doors - by tehwhynot - 10-14-2012, 12:28 PM
RE: Keys and Doors - by Ongka - 10-14-2012, 12:33 PM
RE: Keys and Doors - by tehwhynot - 10-14-2012, 12:36 PM
RE: Keys and Doors - by Ongka - 10-14-2012, 12:56 PM
RE: Keys and Doors - by tehwhynot - 10-14-2012, 01:01 PM
RE: Keys and Doors - by The chaser - 10-14-2012, 01:11 PM
RE: Keys and Doors - by tehwhynot - 10-14-2012, 01:13 PM
RE: Keys and Doors - by Ongka - 10-14-2012, 02:31 PM



Users browsing this thread: 4 Guest(s)