If you do this, it would be valid for all exits.
So i would suggest, that you write a custom action.
Example:
var KeyFound=0;
action my_LevelExit()
{
set(my,PASSABLE | INVISIBLE);
while (plBiped01_Entity==NULL) wait(1);
while (1)
{
if (plBiped01_Entity!=NULL)
if (vec_dist(plBiped01_Entity.x,my.x)<=my.skill1&&KeyFound)
{
ix_LevelChangeRequest=my.skill2;
ent_remove(me);
return;
}
wait(5);
}
}
In this action the door waits for you until you are in range (skill1) and have the key. And then changes the level (skill2 is the ID of the level starting with 0 .. numbers of levels).