Greetings everyone.
I'm trying to rewrite the smaug skin code so that, instead of skinning the corpse of another player, players can skin the corpse of a npc and get a hide or a pelt that they could sell in the store.
I'm not really a coder, but I learn fast and I dont give up easily..
I've managed to change the code so that it now allows us to skin NPC's instead of PC's, the problem is that it works on every NPC, when it should only work on certain animals (I'm looking for a way to link it so that it will only work on the NPC class: animal)
Here's the one line that I've changed so far:
in skills.c on line 476
if( corpse->item_type != ITEM_CORPSE_NPC ) /* I changed PC to NPC */
I did the same thing a little further down: skills.c on line 491
korps = create_object( get_obj_index( OBJ_VNUM_CORPSE_NPC ), 0 );
Another problem that I ran across, is that you can continously strip down a corpse. It should be just one pelt or hide per corpse.
Here's the piece of code that is handling corpse skinning.. (maybe there is more that I dont know of)
void do_skin( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *korps;
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *skin;
bool found;
char *name;
char buf[MAX_STRING_LENGTH];
found = FALSE;
if( !IS_PKILL( ch ) && !IS_IMMORTAL( ch ) )
{
send_to_char( "Dat is iets voor echte jagers!\n", ch );
return;
}
if( argument[0] == '\0' )
{
send_to_char( "Welk kadaver wil je villen?\n\r", ch );
return;
}
if( ( corpse = get_obj_here( ch, argument ) ) == NULL )
{
send_to_char( "Je kunt het niet vinden.\n\r", ch );
return;
}
if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL )
{
send_to_char( "Je hebt een scherp wapen nodig om te kunnen villen.\n\r", ch );
return;
}
if( corpse->item_type != ITEM_CORPSE_NPC )
{
send_to_char( "Dit lichaam kun je niet villen.\n\r", ch );
return;
}
if( obj->value[3] != 1 && obj->value[3] != 2 && obj->value[3] != 3 && obj->value[3] != 11 )
{
send_to_char( "Je kunt hier niks mee..\n\r", ch );
return;
}
if( get_obj_index( OBJ_VNUM_SKIN ) == NULL )
{
bug( "Vnum 23 (OBJ_VNUM_SKIN) not found for do_skin!", 0 );
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;
sprintf( buf, skin->short_descr, name );
STRFREE( skin->short_descr );
skin->short_descr = STRALLOC( buf );
sprintf( buf, skin->description, name );
STRFREE( skin->description );
skin->description = STRALLOC( buf );
act( AT_BLOOD, "$n vilt $p.", ch, corpse, NULL, TO_ROOM );
act( AT_BLOOD, "Je vilt $p.", ch, corpse, NULL, TO_CHAR );
/* act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_CHAR);
act( AT_MAGIC, "\nThe skinless corpse is dragged through the ground by a strange force...", ch, corpse, NULL, TO_ROOM);
extract_obj( corpse ); */
obj_to_char( skin, ch );
return;
}
So, what I want it to do is only skin the corpse of a NPC with the class animal (or something similar), and have it so that only one pelt will come of the corpse.
I would be very thankfull if someone could help me fix this..
-Addrodoc-
|