03-10-2012, 11:32 AM
I'm having 2 keys in my map.
The first key you can pick up unlocks a door into another room.
On the way to the locked door, you pass another locked door. But when you unlock the door with the valid key, the other door becomes unlocked automatic... However the next key still works on the newly unlocked door...
Here is my script:
////////////////////////////
// Run first time starting map
void OnStart()
{
}
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");
SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("key2");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
What is wrong?
The first key you can pick up unlocks a door into another room.
On the way to the locked door, you pass another locked door. But when you unlock the door with the valid key, the other door becomes unlocked automatic... However the next key still works on the newly unlocked door...
Here is my script:
////////////////////////////
// Run first time starting map
void OnStart()
{
}
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");
SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("key2");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
What is wrong?