sorry i guess i should have mentioned a couple things. it makes sense that when the timer expires, it does not find the corpse anywhere since you are not storing the argument. also when i went to check if you were storing the argument, i found this:
if ( number_percent( ) < schance )
{
send_to_char( "&GYou begin the process of skinning a corpse.\n\r", ch);
act( AT_PLAIN, "$n takes $s knife and begins to skin a corpse.", ch, NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 2 , do_skin , 1 );
ch->alloc_ptr = str_dup( buf );
return;
}
as of this point you have yet to set buf to anything, i assume you meant:
ch->alloc_ptr = str_dup( argument );
so try the following:
void do_skin( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *korps, *corpse, *obj, *skin;
bool checkknife;
char *name;
char buf[MAX_STRING_LENGTH];
int schance;
switch ( ch->substate )
{
default:
if( argument[0] == '\0' )
{
send_to_char( "What corpse do you wish to skin?\r\n", ch );
return;
}
checkknife = FALSE;
if( ( corpse = get_obj_here( ch, argument ) ) == NULL )
{
send_to_char( "You cannot find that here.\r\n", ch );
return;
}
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if ( obj->item_type == ITEM_SKNIFE && obj->wear_loc == WEAR_WIELD )
checkknife = TRUE;
}
if ( !checkknife )
{
send_to_char( "You are not wielding a skinning knife.\r\n", ch );
return;
}
if( corpse->value[4] == 25)
{
send_to_char( "There is no skin on this corpse.\r\n", ch );
return;
}
if( get_obj_index( OBJ_VNUM_SKIN ) == NULL )
{
bug( "Vnum %d (OBJ_VNUM_SKIN) not found for do_skin!", OBJ_VNUM_SKIN );
return;
}
schance = IS_NPC(ch) ? ch->level : (int) (ch->pcdata->learned[gsn_skin]) ;
if ( number_percent( ) < schance )
{
send_to_char( "&GYou begin the process of skinning a corpse.\n\r", ch);
act( AT_PLAIN, "$n takes $s knife and begins to skin a corpse.", ch, NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 2 , do_skin , 1 );
ch->alloc_ptr = str_dup( argument );
return;
}
send_to_char("&RYour knife slips and ruins the skin.\n\r",ch);
learn_from_failure( ch, gsn_skin );
corpse->value[4] = 25;
return;
case 1:
if( !ch->alloc_ptr )
return;
mudstrlcpy( buf, ch->alloc_ptr, MAX_INPUT_LENGTH );
DISPOSE( ch->alloc_ptr );
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->alloc_ptr );
ch->substate = SUB_NONE;
send_to_char( "You carefully stop what you were doing.\r\n", ch );
return;
}
ch->substate = SUB_NONE;
if( ( corpse = get_obj_here( ch, buf ) ) == NULL )
{
send_to_char( "You cannot find that here.\r\n", ch );
return;
}
korps = create_object( get_obj_index( OBJ_VNUM_CORPSE_NPC ), 0 );
skin = create_object( get_obj_index( OBJ_VNUM_SKIN ), 0 );
name = IS_NPC( ch ) ? korps->short_descr : corpse->short_descr;
snprintf( buf, MAX_STRING_LENGTH, skin->short_descr, name );
STRFREE( skin->short_descr );
skin->short_descr = STRALLOC( buf );
snprintf( buf, MAX_STRING_LENGTH, skin->description, name );
STRFREE( skin->description );
skin->description = STRALLOC( buf );
corpse->value[4] = 25;
act( AT_BLOOD, "$n strips the skin from $p.", ch, corpse, NULL, TO_ROOM );
act( AT_BLOOD, "You strip the skin from $p.", ch, corpse, NULL, TO_CHAR );
obj_to_char( skin, ch );
return;
}
|