Re: weapon flags

From: Shane Augustine (sca@bu.edu)
Date: 02/23/99


Hi thanks for the suggestion.  I created a new value field for objs and I redid
all the obj files to include a fifth argument.  Now the mud boots through all
the objs
but when it gets to loading the zones, I get the following error:
    SYSERR: Trigger #209125141 non-existant, for obj #99
If i remove this object, then I get some funky other errors and it'll crash on a
diff
obj.  I don't have any triggers saved on obj #99.  The code it points to is:
case OBJ_TRIGGER:
      obj = (obj_data *)i;
      trg_proto = obj->proto_script;
      while (trg_proto) {
        rnum = real_trigger(trg_proto->vnum);
     if (rnum==-1) { <==================== THIS LINE
          sprintf(buf,"SYSERR: trigger #%d non-existant, for obj #%d",
            trg_proto->vnum, obj_index[obj->item_number].vnum);
          log(buf);
        } else {
          if (!SCRIPT(obj))
            CREATE(SCRIPT(obj), struct script_data, 1);
          add_trigger(SCRIPT(obj), read_trigger(rnum), -1);
        }
        trg_proto = trg_proto->next;
      }
      break;
where rnum = -1.  I also want to thank everyone for the help on mounts.  As soon
as
I get something workable, I'll contribute it.

Richard Glover wrote:

> You'll have to add a new variable to obj_flag_data in structs.h.  2
> approaches that I can think of will work.
>
> 1) Make a completely new variable.
> 2) Increase the # of 'values' that all items have.
>
> Either method will consume the same amount of memory.  The 2nd method will
> allow you to add other parameters to your objects as well as ITEM_WEAPON.
>
> The 'values' are integers in stock and can handle up to 32 flags in a 32bit
> compiler/opsys.
>
> Create a new set of bit flags in structs.h for your weapons like
>
> WPN_SLYUNDEAD    (1 << 0)
> WPN_SLYOOZE          (1 << 1)
> etc...
>
> Make a new macro in utils.h (not necessary, but handy).  I'll assume you
> chose option #2.
>
> #define WPN_FLAGS(obj)    ((obj)->obj_flags.value[4])
> #define WPN_FLAGGED(obj, flag)    (IS_SET(WPN_FLAGS(obj), (flag)))
>
> Then you'll have to change your object files to have 1 more parameter on the
> numeric line that the rest of the obj values are on in db.c.
>
> parse_object():
>   if ((retval = sscanf(line, "%d %d %d %d %d", t, t + 1, t + 2, t + 3, t +
> 4)) != 5) {
>     log("SYSERR: Format error in second numeric line (expecting 4 args, got
> %d), %s", retval, buf2);
>     exit(1);
>   }
>   obj_proto[i].obj_flags.value[0] = t[0];
>   obj_proto[i].obj_flags.value[1] = t[1];
>   obj_proto[i].obj_flags.value[2] = t[2];
>   obj_proto[i].obj_flags.value[3] = t[3];
>   obj_proto[i].obj_flags.value[3] = t[4];
>
> If you have OasisOLC, then change oedit.c, oedit_save_to_disk.  I'll let you
> figure out how.
>
> The rest is up to you, making checks on the WPN_FLAGGED and whatnot.
>
> Have fun,
> Rick
>
> -----Original Message-----
> From: Shane Augustine <sca@bu.edu>
> To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
> Date: Friday, February 19, 1999 8:09 PM
> Subject:  weapon flags
>
> >I want to create weapon flags so these flags will only affect weapons
> >and not
> >other objs.  It is a waste of flags using item_undead_slayer for obj
> >flags when this
> >flag is only affective on weapons.  How would i go about adding
> >specialized flags
> >for only objs?
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>      +------------------------------------------------------------+


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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