Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, DotBot

Members: 0
Guests: 20
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Question
Forum Rules | Mark all | Recent Posts

Question
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 5, 2013, 9:04 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Where in the smaug code does equipment taking damage from fights happen?
       
Post is unread #2 Sep 5, 2013, 10:23 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

actually found that, But I need help with this


damage_obj (obj=0x0) at act_obj.c:1423
1423      ch = obj->carried_by;
(gdb) backtrace
#0  damage_obj (obj=0x0) at act_obj.c:1423
#1  0x0825c23c in do_acid_slash (ch=0xcd6f060, argument=0xbfffe500 "";)
    at skills_saibaman.c:837
#2  0x081d5154 in check_ability (ch=0xcd6f060,
    command=0xbfffe0ac "acid slash", argument=0xbfffe500 "";) at skills.c:781
#3  0x081607c3 in interpret (ch=0xcd6f060, argument=<value optimized out>;)
    at interp.c:811
#4  0x0810e713 in game_loop () at comm.c:1055
#5  0x0810f37f in main (argc=Cannot access memory at address 0x21
) at comm.c:423



here is the damage_obj code
obj_ret damage_obj( OBJ_DATA * obj )
{
  CHAR_DATA *ch;
  obj_ret objcode;

  ch = obj->carried_by; <---- CRASHES HERE
  objcode = rNONE;

  separate_obj( obj );
  if( !IS_NPC( ch ) && ( !IS_PKILL( ch ) || ( IS_PKILL( ch ) && !IS_SET( ch->pcdata->flags, PCFLAG_GAG ) ) ) )
    act( AT_OBJECT, "($p gets damaged)", ch, obj, NULL, TO_CHAR );
  else if( obj->in_room && ( ch = obj->in_room->first_person ) != NULL )
  {
    act( AT_OBJECT, "($p gets damaged)", ch, obj, NULL, TO_ROOM );
    act( AT_OBJECT, "($p gets damaged)", ch, obj, NULL, TO_CHAR );
    ch = NULL;
  }

  if( obj->item_type != ITEM_LIGHT )
    oprog_damage_trigger( ch, obj );
  else if( !in_arena( ch ) )
    oprog_damage_trigger( ch, obj );

  if( obj_extracted( obj ) )
    return global_objcode;

  switch ( obj->item_type )
  {
    default:
      make_scraps( obj );
      objcode = rOBJ_SCRAPPED;
      break;
    case ITEM_CONTAINER:
    case ITEM_KEYRING:
    case ITEM_QUIVER:
      if( --obj->value[3] <= 0 )
      {
        if( !in_arena( ch ) )
        {
          make_scraps( obj );
          objcode = rOBJ_SCRAPPED;
        }
        else
          obj->value[3] = 1;
      }
      break;
    case ITEM_LIGHT:
      if( --obj->value[0] <= 0 )
      {
        if( !in_arena( ch ) )
        {
          make_scraps( obj );
          objcode = rOBJ_SCRAPPED;
        }
        else
          obj->value[0] = 1;
      }
      break;
    case ITEM_ARMOR:
      if( ch && obj->value[0] >= 1 )
        ch->armor += apply_ac( obj, obj->wear_loc );
      if( --obj->value[0] <= 0 )
      {
        if( !in_arena( ch ) )
        {
          make_scraps( obj );
          objcode = rOBJ_SCRAPPED;
        }
        else
        {
          obj->value[0] = 1;
          ch->armor -= apply_ac( obj, obj->wear_loc );
        }
      }
      else if( ch && obj->value[0] >= 1 )
        ch->armor -= apply_ac( obj, obj->wear_loc );
      break;
    case ITEM_WEAPON:
      if( --obj->value[0] <= 0 )
      {
        if( !in_arena( ch ) )
        {
          make_scraps( obj );
          objcode = rOBJ_SCRAPPED;
        }
        else
          obj->value[0] = 1;
      }
      break;
  }
  return objcode;
}


And here is the skill, The number_range is set to always happen for testing.
void do_acid_slash( CHAR_DATA * ch, char *argument )
{
  CHAR_DATA *victim;

  if( IS_NPC( ch ) && IS_AFFECTED( ch, AFF_CHARM ) )
  {
    send_to_char( "You can't concentrate enough for that.\n\r", ch );
    return;
  }
  if( !IS_NPC( ch ) && ch->exp < skill_table[gsn_acid_slash]->skill_level[ch->class] )
  {
    send_to_char( "You better leave the martial arts to fighters.\n\r", ch );
    return;
  }

  if( ( victim = who_fighting( ch ) ) == NULL )
  {
    send_to_char( "You aren't fighting anyone.\n\r", ch );
    return;
  }

  if( !IS_NPC( ch ) && ch->mana < skill_table[gsn_acid_slash]->min_mana )
  {
    send_to_char( "You don't have enough energy.\n\r", ch );
    return;
  }
  if( ch->focus < skill_table[gsn_acid_slash]->focus )
  {
    send_to_char( "You need to focus more.\n\r", ch );
    return;
  }
  else
    ch->focus -= skill_table[gsn_acid_slash]->focus;

  WAIT_STATE( ch, skill_table[gsn_acid_slash]->beats );

  if( !is_android_h( ch ) )
    ch->mana -= skill_table[gsn_acid_slash]->min_mana;

  if( can_use_skill( ch, number_percent(  ), gsn_acid_slash ) )
  {
/*
Your feet claws dig into the ground, bracing yourself to where you stand.  You grin manically, before grabbing each side of your head.  You slowly pull on your head, tearing your forehead apart with a sickening squelch.  You release one side of your head to dip your claws into the gap, slowly swirling your claws around inside.  As you pull your claws out, you charge energy into your claws, and the acid that now covers them.  You look at your claws, as they drip with glowing green acid, the droplets burning into the ground at your feet.  Suddenly, you release your grip to the ground, and propel yourself to (Foe), slashing quickly at (His/her/it)'s chest!'*/
    act( AT_LBLUE, "Compressing your left leg into a crouched position, you strain your leg", ch, NULL, victim, TO_CHAR );
    act( AT_LBLUE, "muscles until they can noticeably be seen bulging outwards.  In one swift", ch, NULL, victim, TO_CHAR );
    act( AT_LBLUE, "motion you spring upwards and rotate your body full circle with your right", ch, NULL, victim, TO_CHAR );
    act( AT_LBLUE, "limb extended.  Your foot firmly plants into $N's chest and sends", ch, NULL, victim, TO_CHAR );
    act( AT_LBLUE, "them tumbling to the ground.", ch, NULL, victim, TO_CHAR );

    act( AT_LBLUE, "$n compresses $s left leg into a crouched position, $n strain $s leg", ch, NULL, victim, TO_NOTVICT );
    act( AT_LBLUE, "muscles until they can noticeably be seen bulging outwards.  In one swift", ch, NULL, victim,
         TO_NOTVICT );
    act( AT_LBLUE, "motion $n spring upwards and rotate $s body full circle with thir right", ch, NULL, victim, TO_NOTVICT );
    act( AT_LBLUE, "limb extended.  $n's foot firmly plants into $N's chest and sends", ch, NULL, victim, TO_NOTVICT );
    act( AT_LBLUE, "them tumbling to the ground. ", ch, NULL, victim, TO_NOTVICT );

    act( AT_LBLUE, "$n compressing thir left leg into a crouched position, they strain their leg", ch, NULL, victim,
         TO_VICT );
    act( AT_LBLUE, "muscles until they can noticeably be seen bulging outwards.  In one swift", ch, NULL, victim, TO_VICT );
    act( AT_LBLUE, "motion they spring upwards and rotate their body full circle with their right", ch, NULL, victim,
         TO_VICT );
    act( AT_LBLUE, "limb extended.  Their foot firmly plants into your chest and sends", ch, NULL, victim, TO_VICT );
    act( AT_LBLUE, "you tumbling to the ground. ", ch, NULL, victim, TO_VICT );
  OBJ_DATA *damobj;
  int dameq;
 if (!IS_NPC ( victim) )
	{
	 if (number_range(1,50) <= 50)
	 {
	        dameq = number_range(WEAR_LIGHT, WEAR_GEAR);
            damobj = get_eq_char(victim, dameq);
		    damage_obj(damobj);           
                act( AT_GREEN, "You suddenly shoot acid at $N and grin as it strikes a piece of $S clothing!", ch, NULL, victim, TO_CHAR );
                act( AT_GREEN, "$n suddenly shoots acid at you and grins as it strikes a piece of your clothing!", ch, NULL, victim, TO_VICT );
                act( AT_GREEN, "$n suddenly shoots a acid at $N and grins as it strikes a piece of $S clothing!", ch, NULL, victim, TO_NOTVICT );

     }
    }
    learn_from_success( ch, gsn_acid_slash );
    ch->melee = TRUE;
    global_retcode = damage( ch, victim, ( get_attmod( ch, victim ) * number_range( 42, 48 ) ), gsn_acid_slash );
    ch->melee = FALSE;
  }
  else
  {
    act( AT_SKILL, "You twist and fly at $N but miss.", ch, NULL, victim, TO_CHAR );
    act( AT_SKILL, "$n kicks hard at you but misses you by an inch.", ch, NULL, victim, TO_VICT );
    act( AT_SKILL, "$n kicks hard at $N but $N dodges quickly.", ch, NULL, victim, TO_NOTVICT );
    learn_from_failure( ch, gsn_acid_slash );
    ch->melee = TRUE;
    global_retcode = damage( ch, victim, 0, gsn_acid_slash );
    ch->melee = FALSE;
  }
return;
}
       
Post is unread #3 Sep 5, 2013, 2:12 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

            damobj = get_eq_char(victim, dameq);
		    damage_obj(damobj);           
                act( AT_GREEN, "You suddenly shoot acid at $N and grin as it strikes a piece of $S clothing!", ch, NULL, victim, TO_CHAR );
                act( AT_GREEN, "$n suddenly shoots acid at you and grins as it strikes a piece of your clothing!", ch, NULL, victim, TO_VICT );
                act( AT_GREEN, "$n suddenly shoots a acid at $N and grins as it strikes a piece of $S clothing!", ch, NULL, victim, TO_NOTVICT );

change it to
            if( ( damobj = get_eq_char(victim, dameq) ) )
            {
                damage_obj(damobj);           
                act( AT_GREEN, "You suddenly shoot acid at $N and grin as it strikes a piece of $S clothing!", ch, NULL, victim, TO_CHAR );
                act( AT_GREEN, "$n suddenly shoots acid at you and grins as it strikes a piece of your clothing!", ch, NULL, victim, TO_VICT );
                act( AT_GREEN, "$n suddenly shoots a acid at $N and grins as it strikes a piece of $S clothing!", ch, NULL, victim, TO_NOTVICT );
            }

I would suggest tossing in a check in the damage_obj function to make sure the obj isn't NULL also lol
       
Post is unread #4 Sep 5, 2013, 5:30 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

THANKS I thought it was something like that too. Just couldn't find the spot where it was trying to use a null obj
       
Pages:<< prev 1 next >>