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.