mpdamage all on objs?

Posted by Zeno on Mon 13 Feb 2006 01:12 AM — 8 posts, 28,539 views.

USA #0
I'm looking to change mpdamage all so it doesn't hit the user. In stock, it doesn't if it's a mob, but if it's an object and the user is wearing the object, it'll hurt the wearer. Now since the actual user is the supermob, that's why it's hitting the wearer. But I don't know how to change the loop so it ignores the wearer. The only arguments for mpdamage is CHAR_DATA and the argument. CHAR_DATA being the supermob, I don't know if anything on the supermob points to the wearer. Any ideas?
USA #1
Can you paste the loop?
USA #2
In do_mpdamage:
    if ( !str_cmp( arg1, "all" ) )
    {
        for ( victim = ch->in_room->first_person; victim; victim = nextinroom )
        {
            nextinroom = victim->next_in_room;
            if ( victim != ch
            &&   can_see( ch, victim ) ) /* Could go either way */
            {
                sprintf( buf, "'%s' %s", victim->name, arg2 );
                do_mp_damage( ch, buf );
            }
        }
        return;
    }


Either I need to make a new argument (all2) or change this. Either way, it needs to somehow find the wearer of the obj.
USA #3
Yes, you may consider changing the calls to put the name of the user as the first argument and modify it accordingly. There are a few other options, but they are far more dubious.
USA #4
You mean an extra argument for the function? Like instead of:
mpdamage all 100

It would be:
mpdamage all 100 $n
USA #5
An extra argument would be the easiest way to determine who not to damage with an objprog. The function has no way to know who used the item otherwise since the supermob is the one carrying it out.
USA #6
I keep getting a conflicting error on compile. Maybe it's because my header doesn't have the normal arguments?
void do_mp_damage2( CHAR_DATA *ch, CHAR_DATA *avoid, char *argument )


mud.h:DECLARE_DO_FUN( do_mp_damage2     );


  Compiling o/mud_comm.o....
mud_comm.c:2165: error: conflicting types for 'do_mp_damage2'
mud.h:4694: error: previous declaration of 'do_mp_damage2' was here
make[1]: *** [o/mud_comm.o] Error 1


Any ideas what I should do?
USA #7
DECLARE_DO_FUN declares a function that has two arguments: the actor and the arguments. You cannot declare a do_fun that doesn't have two arguments.

If you want to use a three-argument function, you will need to wrap a two-argument function around it, that parses the input and does all necessary stuff to it.