Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ mpdamage all on objs?

mpdamage all on objs?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zeno   USA  (2,871 posts)  Bio
Date Mon 13 Feb 2006 01:12 AM (UTC)
Message
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?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #1 on Mon 13 Feb 2006 01:34 AM (UTC)
Message
Can you paste the loop?

~Nick Cash
http://www.nick-cash.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Mon 13 Feb 2006 01:37 AM (UTC)
Message
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.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #3 on Mon 13 Feb 2006 01:55 AM (UTC)
Message
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.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Mon 13 Feb 2006 02:10 AM (UTC)
Message
You mean an extra argument for the function? Like instead of:
mpdamage all 100

It would be:
mpdamage all 100 $n

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #5 on Mon 13 Feb 2006 11:44 AM (UTC)
Message
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.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #6 on Wed 15 Feb 2006 10:46 PM (UTC)
Message
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?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Thu 16 Feb 2006 02:47 AM (UTC)
Message
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.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,946 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.