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 ➜ Can i add items held as weapon in damage code?

Can i add items held as weapon in damage code?

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


Posted by Oblisgr   (123 posts)  Bio
Date Fri 24 Jan 2020 10:05 PM (UTC)

Amended on Fri 24 Jan 2020 10:15 PM (UTC) by Oblisgr

Message
The message below
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #1 on Fri 24 Jan 2020 10:06 PM (UTC)

Amended on Fri 24 Jan 2020 10:11 PM (UTC) by Fiendish

Message
Can anyone please help add the weapons name in the damage output and replace the damage type? Please help me because i m learning coding smaug.


            if( skill->miss_char && skill->miss_char[0] != '\0' )
            {
               act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
               found = TRUE;
            }
            if( skill->miss_vict && skill->miss_vict[0] != '\0' )
            {
               act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
               found = TRUE;
            }
            if( skill->miss_room && skill->miss_room[0] != '\0' )
            {
               if( str_cmp( skill->miss_room, "supress" ) )
                  act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
               found = TRUE;
            }
            if( found ) /* miss message already sent */
            {
               if( was_in_room )
               {
                  char_from_room( ch );
                  char_to_room( ch, was_in_room );
               }
               return;
            }
         }
         else
         {
            if( skill->hit_char && skill->hit_char[0] != '\0' )
               act( AT_HIT, skill->hit_char, ch, NULL, victim, TO_CHAR );
            if( skill->hit_vict && skill->hit_vict[0] != '\0' )
               act( AT_HITME, skill->hit_vict, ch, NULL, victim, TO_VICT );
            if( skill->hit_room && skill->hit_room[0] != '\0' )
               act( AT_ACTION, skill->hit_room, ch, NULL, victim, TO_NOTVICT );
         }
      }
      else if( dt >= TYPE_HIT && dt < TYPE_HIT + sizeof( attack_table ) / sizeof( attack_table[0] ) )
      {
         if( obj )
            attack = obj->short_descr;
         else
            attack = attack_table[dt - TYPE_HIT];
      }
      else
      {
         bug( "Dam_message: bad dt %d from %s in %d.", dt, ch->name, ch->in_room->vnum );
         attack = attack_table[0];
      }

      snprintf( buf1, 256, "$n's [%s] %s $N for [%d] dmg.", attack, vp, dam);
      snprintf( buf2, 256, "Your [%s] %s $N for [%d] dmg.", attack, vp, dam);
      snprintf( buf3, 256, "$n's [%s] %s you for [%d] dmg.", attack, vp, dam);
   }
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #2 on Fri 24 Jan 2020 10:13 PM (UTC)
Message
I edited your posts to use code tags.
What exactly are we looking at here? What file is this in? Where did you get it from? Please provide links.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #3 on Fri 24 Jan 2020 10:26 PM (UTC)

Amended on Fri 24 Jan 2020 10:27 PM (UTC) by Oblisgr

Message
it a part of the code in fight.c of smaugfuss 1.9.3

this part of the code when the players hold a weapon
(line 3896 in fight.c)

and if unarmed too
(line 3819 in fight c).

i hope this will help you.
(i didnt understood what you mean by links)
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #4 on Fri 24 Jan 2020 10:33 PM (UTC)
Message

Links means the URL of the file you downloaded. That way we can download it too and look at it, and be sure we are all looking at the same file(s).

For example: https://smaugmuds.afkmods.com/files/smaugfuss-193-500/


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #5 on Fri 24 Jan 2020 10:42 PM (UTC)
Message
Nick this is the link exactly as you posted above.
Smaugfuss 1.9.3

https://smaugmuds.afkmods.com/files/smaugfuss-193-500/
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #6 on Sat 25 Jan 2020 06:39 PM (UTC)
Message
Any result for me, pls
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #7 on Sat 25 Jan 2020 07:59 PM (UTC)

Amended on Sat 25 Jan 2020 08:05 PM (UTC) by Fiendish

Message
That function looks like it already does the right thing, BUT, I looked at the rest of the code and I don't see anywhere that actually passes a value to obj. I think that whoever added the new_dam_message function didn't finish integrating it.

The stupid hack bad programming way might be to to insert

obj = used_weapon;
at the beginning of the new_dam_message function in fight.c.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #8 on Sat 25 Jan 2020 09:09 PM (UTC)
Message
you mean the start of this?

void new_dam_message( CHAR_DATA * ch, CHAR_DATA * victim, int dam, unsigned int dt, OBJ_DATA * obj )
{
char buf1[256], buf2[256], buf3[256];
const char *vs;
const char *vp;
const char *attack;
char punct;
int dampc;
struct skill_type *skill = NULL;
bool gcflag = FALSE;
bool gvflag = FALSE;
int d_index, w_index;
ROOM_INDEX_DATA *was_in_room;

if( !dam )
dampc = 0;
else
dampc = ( ( dam * 1000 ) / victim->max_hit ) + ( 50 - ( ( victim->hit * 50 ) / victim->max_hit ) );
.....
....
....
Top

Posted by Oblisgr   (123 posts)  Bio
Date Reply #9 on Sat 25 Jan 2020 10:17 PM (UTC)
Message
I worked.
Thank you
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.


22,657 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.