I have an elven wizard that has found a huge stash of valuable loot by chance of trap-door discovering a multi-boned level. Unfortunately, he's about to die of starvation locked in a room, or be killed by the invisible monster that killed the others. He's too deep for him to fight and prayer is used up, he's going to die. I'd hate to see all this loot vanish before another more worthy character gets a chance to sort through all of it. Can I do something to ensure this level makes the bones file? If so, how? If not, what are the odds that it will store as bones?
Assuming you aren't on one of the levels that can't leave a bones file (basically any level that isn't randomly generated), there is a (depth/4)/(1+depth/4) chance of leaving a bones file. Both of those (depth/4)s are integer division, that is, rounded down.
There is no way to guarantee a bones file, but if you're deep enough into the dungeon, you're very likely to get one.