Usenet.com

www.Usenet.com

Group Index

Rec Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Looking for a piece of code



"Paul Tangfeldt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well, I'm looking for a piece of code, or help to code, two things for my
> circlebased mud.
>
> First I want to code a greet system, so you won't see other players names
> unless they've greeted you.
>
> Second, I also want to code a bodypart system, where you can lose limbs
etc
> in combat.
>
> Has anyone got any pointers I could look at for this?
>
> Thanks, Paul Tångfeldt
>
These are how I would code it, but that doesn't mean it is necessarily the
"right" way.
for the greet system I have 2 methods:
    method 1: create a new datatype like
    struct known_person
    {
        char *name;
        struct known_person *next;
    };
      simply add new nodes when someone greets themselves to another.
    method 2: create a delimited string with all persons known.
    the problems with both is that as the person meets more and more people,
you will get a lot of overhead unless you can create a faster means of
searching for persons that are known.

for the body parts.  the easiest way is to create a new field I your
char_data or pc_data or what have you of type int.  create a buncha of new
bitvectors (i.e. LOST_LEFT_ARM, LOST_RIGHT_ARM, etc)
create a function that is randomly decides where to cut something off, set
the bit, remove the proper equipment from the victim.  then simply call the
function on a crit hit, spell, or whatever.  also be sure to modify your
equip code so that if someone has lost a body part, they cant re-wear the
item.  You may also want to modify your movement and regen code as well.





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.