Re: [Code] Is there a way..

From: Brian Guilbault (guil9964@nova.gmi.edu)
Date: 02/05/97


On Wed, 5 Feb 1997, Elvis Mohan wrote:

> 	Does anyone know of a way to allow a character to
> get stuff from his corpse *only*  and not other player corpses ?

Here's what I did. I first added a new item to the object data structure 
called obj->owner and made a macro to it called GET_OBJ_OWNER. In 
make_corpse I set that value equal to the character's idnum when they 
die, or to -1 if it's a mob's corpse.

I defined a new function called int can_loot in fight.c which checks the 
owner value of the corpse against the idnum of the player trying to get 
it. If the value is -1, it returns true. If the two values are equal it 
returns true. If they are not equal, it returns a little corpse-loot 
message and false.

Then in perform_get_from_container and I think in perform_get, I just 
call can_loot. If it returns true, I allow the get, if false, I exit the 
function.

Overall it's not really hard to do, but requires a lot of thought...one 
thing that through me for awhile is the "get all all.corpse". I didn't 
want to show the message once for every item the player tried to take 
because a corpse full of items would show 2 or 3 screens of messages. I 
just use a counter, and increment it once per item. If it is greater than 
1, I return true, else I return false. My perticular code is a bit more 
complex because of the outlaw system on our mud....I let anyone get 
outlaw's corpses, etc.

This works -very- well for me and has been for some time now. I just make 
sure it is in my policy that a corpse is fair game once it decays. That 
gives players a few minutes to get it back. One thing I plan in the 
future is a "trust" command. That would let a player "trust" another to 
be able to get the contents of their corpse.

Hope that all helps,

   -Brian 


-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Brian Guilbault - GMI Engineering Institute
E-mail: guil9964@gmi.edu, dante@i-55.com
WWW: http://www.gmi.edu/~guil9964/
QuarantineMUD: Telnet to exit2.i-55.com 4000
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST