So you want to use the key on a locked Iron Maiden, and then a monster appears behind you? I hope I got that right. Anyways, this is the script that hopefully works, I haven't tested it myself.
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofIronMaiden", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("nameofkey");
}
You could either choose to let the monster spawn when you unlock the door, or when you open the door after you've unlocked it. The first one is very easy. Just add SetEntityActive("NameofMonster", true); to void UsedKeyOnDoor(string &in asItem, string &in asEntity). Make sure you have an inactive monster in your level editor on the place you want him to spawn.
Here is the second one.
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofIronMaiden", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("nameofkey");
}
void NAMEofFUNCTION(string &in entity)
{
SetEntityActive("NameofMonster", true);
}
Click the iron maiden in the level editor and go to the Entity tab. Write NAMEofFUNCTION in "PlayerInteractCallback".