What about a box for keys in the item editor where you type in the number of the DMap that the key will work in, regardless of where it is found?
Why this? I'm not particularly interested in adding a mechanic where items are hardcoded to dmaps, versus this:
item script dmap_key { void run() { ++Game->LKeys[this->Attributes[0]]; Game->PlaySound(this->UseSound); } }
Place that as the pickup script on a custom item in 2.54, and it'll add the key for a specific dmap.
In 2.50.x/2.53, you would use InitD[] args instead of ->Attributes[].
This is much safer for the future.