Feature Discussion -- Death and keys
Feature Discussion -- Death and keys
With several of (many) deaths I've experienced, my key has either been dropped or has been left in a weilded slot. I've been trying to figure out how this happens, and the only thing I've come up with this:
When a player is turned into a ghost, the inventory is sorted by value, then dropped, starting with the best items and ending with the worst. If during this process a key is found, that item is skipped.
After the entire inventory has been handled, the size of the inventory is set to zero. This is done even if a key is, or multiple keys are, found.
I suggest creating a new variable (s16b) 'num_keys' and initializing it to zero. Then, when a key is found in inventory:
/* do not drop keys, but track them so we don't reset inventory
as empty if there are keys in it. */
if (p_ptr->inventory.tval == TV_KEY)
{
num_keys++;
continue;
}
finally, set inventory size to num_keys instead of zero:
/* He is carrying nothing except keys */
p_ptr->inven_cnt = num_keys;
Hopefully this will remove the weirdness we've been seeing...
When a player is turned into a ghost, the inventory is sorted by value, then dropped, starting with the best items and ending with the worst. If during this process a key is found, that item is skipped.
After the entire inventory has been handled, the size of the inventory is set to zero. This is done even if a key is, or multiple keys are, found.
I suggest creating a new variable (s16b) 'num_keys' and initializing it to zero. Then, when a key is found in inventory:
/* do not drop keys, but track them so we don't reset inventory
as empty if there are keys in it. */
if (p_ptr->inventory.tval == TV_KEY)
{
num_keys++;
continue;
}
finally, set inventory size to num_keys instead of zero:
/* He is carrying nothing except keys */
p_ptr->inven_cnt = num_keys;
Hopefully this will remove the weirdness we've been seeing...
Mangband Project Team Member
Re: Death and keys
Or maybe we should use keyless houses?
Re: Death and keys
Keyless houses would be another solution, but a lot more work, and it would require a database update, which means a server reset. the fix I put in didn't require any of those, and only took a few minutes to figure out...
Mangband Project Team Member
Re: Death and keys
I have had my keys vanish 3 times on death in the past 6 months! What can be done about this? I have tried inscriptionions to find what works. I thought I found a solution last time... I inscribed the key '!*h!k!d!'
That didn't work.
This time I have gone as far as making a key keeper character who is probably going to get audited unless Crimson makes an exception. IF you choose to audit Brandoch that is up to you, Crimson. I would deffinetly like your input on this matter though!
I am guessing I have been too generous in the past and this is my just desserts for messing with Karma. :D
Character:Hundeby
That didn't work.
This time I have gone as far as making a key keeper character who is probably going to get audited unless Crimson makes an exception. IF you choose to audit Brandoch that is up to you, Crimson. I would deffinetly like your input on this matter though!
I am guessing I have been too generous in the past and this is my just desserts for messing with Karma. :D
Character:Hundeby
Re: Death and keys
My main key is inscribed {Main !k!d!s!h!v}
But then again, I've died only once and that was before it became a big problem (I think).
I think the server might be a little sick these days.
Just a feeling.
But then again, I've died only once and that was before it became a big problem (I think).
I think the server might be a little sick these days.
Just a feeling.
-- Mangband Project Team Member
Re: Death and keys
Don't You, Zaphod, put "!k!d!s!h!v" on most every item you intend to keep?
Re: Death and keys
hehe, it depends, it's often !k!v!s for objects I'm gonna put in my houses and stuff in my inventory have !k!v!s!d and sometimes !k!v!s!d!t, after that incident when I tried to tunnel but instead took off half my equipment and it was dropped to the floor and lost. Most keys have !k!v!h
I don't use the !* thing much.
I don't use the !* thing much.
-- Mangband Project Team Member
Re: Death and keys
The key is also quite stealable, which I strongly disagree with.
If the key is something that even a ghost can carry... it is kind of lame to have someone just walk up and gank it.
My friend did it to me once... he gave it back, but really it shouldn't be possible.
If the key is something that even a ghost can carry... it is kind of lame to have someone just walk up and gank it.
My friend did it to me once... he gave it back, but really it shouldn't be possible.
-...
Re: Death and keys
Whoa, keys are stealable?! Wow, yeah, that's no good.
Re: Death and keys
I just experienced something odd.
mangband.org has been really slow, really spiky and crashing frequently today (at least a couple of "real" server crashes, not just everyone lagging out.
Anyway, after the last server crash now I logged back on and time was turned back maybe a minute or something. I bought another item in the BM that I bought before the crash (lucky me) and looked over my equipment and noticed a key was missing. I don't drop keys on purpose so this one just vanished. The house is still owned, the things still inside but key - gone. I asked the others players on the server at the moment, Didy and Zohan and maybe a couple of other guys if they noticed anything strange but nothing besides time being turned back.
A few days ago, maybe a week or two, I noticed a strange thing. I got a character called Genoguy that I use to genocide town now and then when it's too crowded. After doing this one day I died from the strain and dropped all my things (the geno staff and light) but mysteriously a key was sitting where my light used to be. Ok? Well thats peculiar, Genoguy is level 1 and has no house. I moved around town and eventually found a door that the key would open. And there was things inside. Well, I didn't care, I'm rich enough as is, I just left the key in genoguys equipment, didn't want to risk anything being broken by selling the house or dropping the key or anything.
Anyway...
Just a bug report/details.
There is of course a reward for returning the key, and it's not a small one, in case anyone should find a key inscribed {backup this or that}.
Zaphod/Warrior
mangband.org has been really slow, really spiky and crashing frequently today (at least a couple of "real" server crashes, not just everyone lagging out.
Anyway, after the last server crash now I logged back on and time was turned back maybe a minute or something. I bought another item in the BM that I bought before the crash (lucky me) and looked over my equipment and noticed a key was missing. I don't drop keys on purpose so this one just vanished. The house is still owned, the things still inside but key - gone. I asked the others players on the server at the moment, Didy and Zohan and maybe a couple of other guys if they noticed anything strange but nothing besides time being turned back.
A few days ago, maybe a week or two, I noticed a strange thing. I got a character called Genoguy that I use to genocide town now and then when it's too crowded. After doing this one day I died from the strain and dropped all my things (the geno staff and light) but mysteriously a key was sitting where my light used to be. Ok? Well thats peculiar, Genoguy is level 1 and has no house. I moved around town and eventually found a door that the key would open. And there was things inside. Well, I didn't care, I'm rich enough as is, I just left the key in genoguys equipment, didn't want to risk anything being broken by selling the house or dropping the key or anything.
Anyway...
Just a bug report/details.
There is of course a reward for returning the key, and it's not a small one, in case anyone should find a key inscribed {backup this or that}.
Zaphod/Warrior
-- Mangband Project Team Member
Re: Death and keys
Gandalf was so kind to come online today and fixed my problem in just a few seconds, nice work 
He also mentioned that the server is showing signs of "old age" and that this might be the cause of some of the problems we've had lately. However he didn't mention any specific plans for a reset so we'll just have to wait and see how it goes.

He also mentioned that the server is showing signs of "old age" and that this might be the cause of some of the problems we've had lately. However he didn't mention any specific plans for a reset so we'll just have to wait and see how it goes.
-- Mangband Project Team Member
Re: Death and keys
I think my character save must be corrupted!
Today I died and Fink gave me a save... I was relieved to see my key survived this time! I walked up to my house and it said it was owned by somebody else! All my houses have the gear that should be in there.
OK I figured out why I couldn't get in it was wielded!
Why would the key get wielded?
Today I died and Fink gave me a save... I was relieved to see my key survived this time! I walked up to my house and it said it was owned by somebody else! All my houses have the gear that should be in there.
OK I figured out why I couldn't get in it was wielded!
Why would the key get wielded?
Re: Death and keys
Keys should un-wield when you resurrect. Perhaps you encountered a bug?
How many keys did you have when you died? I assume you only had one, but I don't know for sure.
How many keys did you have when you died? I assume you only had one, but I don't know for sure.
By appreciation, we make excellence in others our own property. (Voltaire)
Re: Death and keys
Keys should never be in a wielded slot, they are only allowed as items in your pack. I can't see how they are sometimes moved from inventory to a wielded slot... Oh wait, maybe I do. 
Here's a quick tutorial on how I believe inventory is handled: Inventory is stored as an array of items as part of the larger player object structure. There are currently 36 slots hard coded into that array. The first 23 items (numbered 0-22) are your pack, the next item (numbered 23) is the overflow slot (anything there gets dropped automatically), the last set is the wielded items slots (from the 24 melee weapon to the 35 footgear).
When you die and you are ghosted, your inventory is stepped through and sorted by value. Then this newly sorted list is stepped through, dropping the most expensive items first and the least expensive last. This helps to assure your best items will survive for a while. As they're stepped through, when a key is found, it's skipped. At the end, the inventory is sorted like normal, putting the keys into the last slots of your pack. Since you're not carrying anything but keys, these last slots are really the first slots.
What I'm unsure of is what happens when during the value sort the keys are moved to wielded slots in the larger inventory array. They then wouldn't be sorted down to those first few pack slots and instead would stay wielded. We need to add a bit more complexity to the player death routine to make sure keys are moved to pack slots. Perhaps setting their value artificially high when doing the value sort, thereby forcing them into those first slots?

Here's a quick tutorial on how I believe inventory is handled: Inventory is stored as an array of items as part of the larger player object structure. There are currently 36 slots hard coded into that array. The first 23 items (numbered 0-22) are your pack, the next item (numbered 23) is the overflow slot (anything there gets dropped automatically), the last set is the wielded items slots (from the 24 melee weapon to the 35 footgear).
When you die and you are ghosted, your inventory is stepped through and sorted by value. Then this newly sorted list is stepped through, dropping the most expensive items first and the least expensive last. This helps to assure your best items will survive for a while. As they're stepped through, when a key is found, it's skipped. At the end, the inventory is sorted like normal, putting the keys into the last slots of your pack. Since you're not carrying anything but keys, these last slots are really the first slots.

What I'm unsure of is what happens when during the value sort the keys are moved to wielded slots in the larger inventory array. They then wouldn't be sorted down to those first few pack slots and instead would stay wielded. We need to add a bit more complexity to the player death routine to make sure keys are moved to pack slots. Perhaps setting their value artificially high when doing the value sort, thereby forcing them into those first slots?
Mangband Project Team Member