[code][long]wpn.w.spell.patch and obuild.06

From: Ghost Shaidan (ghost@ao.net)
Date: 01/20/97


I recently downloaded the wpn.w.spell.patch and it patched in almost
seemlessly.  (we put in mult attacks so i had to patch in the fight.c part
by hand).

Looking at the code, I decided that ANY item could be made to cast a
spell, if a check for the values that the patch added were made in teh
write spot.

So, I added this in handler.c in equip_char about line 525:

        if (obj->spell_affect[0].spelltype > 0){
          for (i=0;i< MAX_SPELL_AFFECT; i++){
             call_magic(ch, ch, NULL,
               if (obj->spell_affect[i].spelltype > 0){
                act("Your $p hums and rattles!", FALSE,ch, obj, 0,TO_CHAR);

And it works fine, compiles ok, and if i manually add the lines:

54 200 100

to the end of an obj, every time the char wears an obj, or saves, the obj
WILL cast the spell on the player...

I want it to work in obuild.  I added the following:

extern struct obj_spell_type *spell_affect[MAX_SPELL_AFFECT];
(in the beginning with the /* for objects */ this is JUST A GUESS!)

        "isnum1", "isnum2", "isnum3", "islev1", "islev2",       /*91-95*/
        "islev3", "isper1", "isper2", "isper3", "\n" };         /*96-99*/

   case 91:
    if ((atoi(val_arg) < 1) || (atoi(val_arg) > 130)){
      send_to_char("Valid values for this are 1 through 130.\r\n", ch);
This is my code so the number isnt set to high-----^
This is a hacked cut and paste of the code used to set v0-v3
(cause it seemed so similar)------v
    if(!*val_arg) {
      send_to_char("Usage   :  oset isnum1 <spell number>\r\n", ch);
      send_to_char("This is the number of the spell the item will cast\r\n", ch);
    OBJ_NEW(ch)->spell_affect[0].spelltype = atoi(val_arg);
    half_chop(val_arg, field, val_arg);

I have one of each of these statements for each of the is* commands
each has the right # in the spell_affect[*].* fields..

So i can type oset isnum1 54 islev1 200 isper1 100 and it will say, ok
like it worked, but when i osave, and check the .obj file...
Nothing, and if i edit it manually, and edit any object in that zone, the
extra lines are gone..

This seems to me that Obuild isnt reading it in when it reads the objects
in, or isnt writing it when its done (maybe both).  I havent fixed my 
ostat command to show these yet, so I can't look there.  

In a vain attempt to make it read stuff in, i found in oload where you
load the obj in and added this:

    for(i-0;i < MAX_SPELL_AFFECT; i++){
      obj->spell_affect[i].spelltype  =OBJ_NEW(ch)->spell_affect[i].spelltype;
      obj->spell_affect[i].level      =OBJ_NEW(ch)->spell_affect[i].level;
      obj->spell_affect[i].percentage =OBJ_NEW(ch)->spell_affect[i].percentage;

Now I *THINK* I understand what everything I added does, but I am
obviously missing something...act.build.c is a bit beyond what i am
capable of understanding very easily, (I am slowly figuring more out).  

So does anyone know where i can look to figure this out? suggestions?
hints? or am I way off?

Or do you need more info?

Thanks for any help you may throw my way..

Ghost Shaidan, Questionable Sanity
porsche.ag.net ( 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