Re: [Circle] [IDEA REQUEST] Transfer equipment command.

From: Daniel Koepke (
Date: 11/25/96

On Mon, 25 Nov 1996, Eduardo Gutierrez de Oliveira wrote:

> I wanted to implement a 'snatch' command, that let you, when you saw some
> mortal with extraneous equipment, to snatch the equipment from him. For
> example, you could put 'snatch thunderbolt Frodo' and you would get the
> thuderbolt from Frodo, same thing should work for 'snatch all.potion
> Bilbo', I don't know if I am making myself clear here...

Why not just "force frodo junk thunderbolt"?  If you really want
a snatch command it should be as easy as:

  ACMD(do_snatch) {
    char arg[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    struct char_data *vict;
    struct obj_data *obj, *next_obj;
    int dotmode, i, found;

    two_arguments(argument, arg, arg2);

    if (!*arg2 || !(vict = get_char_room_vis(ch, arg2))) {
      send_to_char("That person isn't here.\r\n", ch);
    } else if (!*arg) {
      send_to_char("Usage: snatch <obj> <player>\r\n", ch);
    } else if (GET_LEVEL(vict) >= GET_LEVEL(ch)) {
      send_to_char("Don't do that!  They may not like it!\r\n", ch);

    dotmode = find_all_dots(arg);
    if (dotmode == FIND_ALL) {
      if (vict->carrying)
        for (obj = vict->carrying; obj; obj = next_obj) {
          next_obj = obj->next_content;
          obj_to_char(obj, ch);
      for (i = 0; i < NUM_WEARS; i++)
        if ((obj = GET_EQ(vict, i)))
          obj_to_char(unequip_char(vict, i), ch);
      send_to_char("Snatched all their items.\r\n", ch);
    } else if (dotmode == FIND_ALLDOT) {
      if (!*arg)
        send_to_char("Snatch all of what?\r\n", ch);
      else {
        found = 0;
        for (obj = vict->carrying; obj; obj = next_obj)
          if (CAN_SEE_OBJ(ch, obj) && isname(arg, obj->name)) {
            found = 1;
            next_obj = obj->next_content;
            obj_to_char(obj, ch);
        for (i = 0; i < NUM_WEARS; i++)
          if ((obj = GET_EQ(vict, i)) && CAN_SEE_OBJ(ch, obj) &&
              isname(arg, obj->name)) {
            found = 1;
            obj_to_char(unequip_char(vict, i), ch);
        if (!found) {
          sprintf(buf, "They don't have any %ss.\r\n", arg);
          send_to_char(buf, ch);
    } else {
      found = 0;
      if (!(obj = get_obj_in_list_vis(ch, arg, vict->carrying))) {
        if (!(obj = get_object_in_equip_vis(ch, arg, vict->equipment, &i))) {
          sprintf(buf, "They aren't using %s %s.\r\n", AN(arg), arg);
          send_to_char(buf, ch);
        } else
          obj_to_char(unequip_obj(vict, i), ch);
      } else {
        obj_to_char(obj, ch);

Note that the above code is untested and I make no gauruntees that
it even compiles, let alone works.  Like most of the code I end up
posting to the list, it is written inside my mailer at the time I
respond to your post -- not pre-written or tested.  Good luck with
getting it to work.  You'll probably see a million problems with it
right off the bat -- don't bother me! -- I could care less about any
problems with this code.  I do not use, do not want to use, do not
have it beyond the copy of this mail that I will unevitiably
receive back.  If someone wants me to make this into a patch or
whatnot, I will...  But I need a little demand for it.

> I also want to limit areas, I was thinking of making flags for the rooms,
> but after a while it seemed ridiculous (I had over 8 flags, having for
> example a flag for not letting anyone under 20 and anyone over 40 to
> enter) and I was thinking if it would be possible to flag the zone itself
> so only a range of levels (implementors aside) could enter it... This
> should prevent also things like teleporting or transferring mobs
> (transferring PCs should be ok). So what I am looking for is a way to
> limit access to entire areas, not just some rooms... So HIgh level PCs
> cannot group with very low level ones and make them up many levels at
> once...

Create the variable:
  int level_range[2];
in the zone_data structure.  Add a field to each zone file to load
in the range.  You might want to make it so that old files that you
don't want to have level limits upon can still be read without the
addition.  I won't explain how to do that here for the sake of time.
Simple enough though, to understand, I think.  Level_range[0] would
be the lowest level permitted in and Level_range[1] would be the
highest level permitted in.  Then you can create a function:

  int can_enter_room(struct char_data *ch, int room) {
    int zone = world[room].number / 100;
    if (GET_LEVEL(ch) >= zone_table[zone].level_range[0] &&
        GET_LEVEL(ch) <= zone_table[zone].level_range[1])
      return 1;
      return 0;

You can also restrict zones to classes by adding an "int class;" to
the zone_data structure and changing can_enter_room like so:

        GET_LEVEL(ch) <= zone_table[zone].level_range[1] &&
        IS_SET(zone_table[zone].class, (1 << GET_CLASS(ch))))
      return 1;
      return 0;

> What else.... Oh yes, what would be the best way to have classes that can
> learn both skill and spells? To change the levels array? The spells array?
> so if it is a spell or skill were not defined by the class but by the
> spell itself?

Uh, classes can already learn both skills and spells.  Just assign
them to the class (see the Circle 3.0bpl11 function in class.c that
assigns all the skills and spells).

> How should I implement clans? Making it just like the classes? Only
> without any kind of affections whatsoever, so you'd be flagged as part of
> a clan and just that? How would you implement a clan channel? (actually I
> am worried about the clan selection in the channel, so you'd only hear
> what your clanmates have to say)

Add a "ubyte clan;" to the player structure somewhere (or change
one of the unused variables).  Create a GET_CLAN macro in utils.h
and then go about definining what a clan is.  For the clan channel
you can create the command: "ctalk".  To have the output from CTALK
only be sent to people of the same clan do:

   if (GET_CLAN(d->character) != GET_CLAN(ch))

Inside the loop of descriptor_list (look at do_gen_comm in act.comm.c).

> 3.-How can I make an object that has an owner and only that owner can load
> it/carry it/wear it

Something like TinyMUD locks, I suppose?  Create a 'long owner;' to be
saved in the rent files and put the creator's idnum into that.  Then
set a special flag for the item like ITEM_LOCKED.  Now, when someone
tries to get/give the object and the obj is flagged ITEM_LOCKED and
the person is not "owner" then don't do it.  I only suggest doing it
for "get/give/sell/junk"  That way if you own the object and drop it,
no-one else can pick it up, but you can give them the object, and they
will be able to use it.

> 4.-How can I make descriptions and flags for objects that are not used in
> all the objects with the same number, I mean, having several daggers, but
> personalize each to some degree, depending on the owner, or putting it
> with flags not common to the object but not changing all similar objects?
> Would another external file do the trick? I know it can be done right now,
> but it gets lost when the player exits or when the mud reboots...

Save the new strings, etc. in the rent files.

Daniel Koepke
Forgive me father, for I am sin.

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

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