The message below
Can i add items held as weapon in damage code?
Posted by Oblisgr on Fri 24 Jan 2020 10:05 PM — 10 posts, 35,555 views.
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);
}
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.
What exactly are we looking at here? What file is this in? Where did you get it from? Please provide links.
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)
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)
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 this is the link exactly as you posted above.
Smaugfuss 1.9.3
https://smaugmuds.afkmods.com/files/smaugfuss-193-500/
Smaugfuss 1.9.3
https://smaugmuds.afkmods.com/files/smaugfuss-193-500/
Any result for me, pls
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 at the beginning of the new_dam_message function in fight.c.
The stupid hack bad programming way might be to to insert
obj = used_weapon;
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 ) );
.....
....
....
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 ) );
.....
....
....
I worked.
Thank you
Thank you