Login
User Name:

Password:



Register

Forgot your password?
Item conditions and Damage
Sep 17, 2022 4:01 pm
By Matteo2303
WSL - Ubuntu Compiling Error
Sep 4, 2022 11:56 am
By Zedethar
18 years ago
Sep 4, 2022 11:52 am
By Zedethar
A SMAUG Collaboration
Sep 4, 2022 12:37 am
By Zedethar
set a mobs practicable skills?
Aug 26, 2022 6:13 pm
By pentair
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
Users Online
CommonCrawl, Google

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
486
3,777
19,574
581
Princess616

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Item conditions and Damage
Forum Rules | Mark all | Recent Posts

Item conditions and Damage
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 4, 2022 10:30 pm   
Go to the top of the page
Go to the bottom of the page

Zedethar
Fledgling
GroupMembers
Posts38
JoinedFeb 21, 2021

 
Hey Everyone,

As I have been recently delving into much area building I came across a rather bothersome issue. All gear I create with Area-Editor or in-game seems to get destroyed in intense combat. I almost want to remove it, I mean completely losing an item seems a bit extreme. Is there a setting or flag that can increase durability or some alternative?

Post is unread #2 Sep 4, 2022 10:58 pm   
Go to the top of the page
Go to the bottom of the page

Zedethar
Fledgling
GroupMembers
Posts38
JoinedFeb 21, 2021

 
/*
 * Damage an object.						-Thoric
 * Affect player's AC if necessary.
 * Make object into scraps if necessary.
 * Send message about damaged object.
 */
obj_ret damage_obj( OBJ_DATA * obj )
{
   CHAR_DATA *ch;
   obj_ret objcode;

   if( IS_OBJ_STAT( obj, ITEM_PERMANENT ) )
      return rNONE;

   ch = obj->carried_by;
   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( !IS_PKILL( ch ) && !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( !IS_PKILL( ch ) && !in_arena( ch ) )
            {
               make_scraps( obj );
               objcode = rOBJ_SCRAPPED;
            }
            else
               obj->value[0] = 1;
         }
         break;
   }
   if( ch != NULL )
      save_char_obj( ch ); /* Stop scrap duping - Samson 1-2-00 */

   if( objcode == rOBJ_SCRAPPED && !IS_NPC( ch ) )
    	log_printf( "%s scrapped %s (vnum: %d)", ch->name, obj->short_descr, obj->pIndexData->vnum );

   return objcode;
}


I am currently looking at the object condition and scrap code itself. I don't know about tweaking it much as I am still learning C programming. Has anyone made changes to this mechanic to at least keep players from losing a piece of equipment? I know Bless and Metal flags give +20% condition bonus. But I can't find in-game or in editor the total points of Condition an item has to make a change. I know condition flag goes from 13 (super condition) down to 0 (broken) So I assume all items have 13 condition points? Which in theory is fine, but could I remove 0 (broken). I know if doing so, it would render the system a bit redundant, but it would still lower the AC of the items so it wouldn't be an entire loss? o.o

Post is unread #3 Sep 17, 2022 4:01 pm   
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts86
JoinedAug 25, 2003

 
objects have values ​​(if I remember correctly from value0 to value5) with different meanings based on the type of object (weapon, armor, light, food, etc). According to the code you posted for weapons and armor the value0 defines the condition of the object (for containers eg value3 is used). If you reach 0 you want the object not to be deleted, just intervene on the conditions that invoke the make_scraps function. If you want the system to keep a sense globally you could consider making that when a worn object is destined to be eliminated, it is instead simply removed from wear (unequip). in wear_obj functions make sure items with "broken" value cannot be worn until repaired (blacksmith?)

It's an idea...

Bye

Pages:<< prev 1 next >>