| Posted by
| Robert Powell
Australia (367 posts) Bio
|
| Message
| There are some other changes that need to be made in order to make it work right. It uses pMobindex->blaa its trying to set values on a mobile when it should be setting them on an object, corpse->blaa, the other change is slice->value3 = this makes the food item poison so delete it and set values for v0 (food value) and v1 (condition).
void do_slice( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *slice;
bool found;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
found = FALSE;
if ( !IS_NPC(ch) && !IS_IMMORTAL(ch)
&& ch->level < skill_table[gsn_slice]->skill_level[ch->class] )
{
send_to_char("You are not learned in this skill.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char("From what do you wish to slice meat?\n\r", ch);
return;
}
if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL
|| ( obj->value[3] != 1 && obj->value[3] != 2 && obj->value[3] != 3
&& obj->value[3] != 11) )
{
send_to_char( "You need to wield a sharp weapon.\n\r", ch);
return;
}
if ( (corpse = get_obj_here( ch, argument )) == NULL)
{
send_to_char("You can't find that here.\n\r", ch);
return;
}
if (corpse->item_type != ITEM_CORPSE_NPC )
{
send_to_char("That is not a suitable source of meat.\n\r", ch);
return;
}
if ( get_obj_index(OBJ_VNUM_SLICE) == NULL )
{
bug("Vnum 24 not found for do_slice!", 0);
return;
}
if ( !can_use_skill(ch, number_percent(), gsn_slice ) && !IS_IMMORTAL(ch))
{
send_to_char("You fail to slice the meat properly.\n\r", ch);
learn_from_failure(ch, gsn_slice); /* Just in case they die :> */
if ( number_percent() + (get_curr_dex(ch) - 13) < 10)
{
act(AT_BLOOD, "You cut yourself!", ch, NULL, NULL, TO_CHAR);
damage(ch, ch, ch->level, gsn_slice);
}
return;
}
slice = create_object( get_obj_index(OBJ_VNUM_SLICE), 0 );
sprintf(buf, "meat fresh slice %s", corpse->name);
STRFREE(slice->name);
slice->name = STRALLOC(buf);
sprintf(buf, "a slice of raw meat from %s", corpse->short_descr);
STRFREE(slice->short_descr);
slice->short_descr = STRALLOC(buf);
sprintf(buf1, "A slice of raw meat from %s lies on the ground.", corpse->short_descr);
STRFREE(slice->description);
slice->description = STRALLOC(buf1);
act( AT_BLOOD, "$n cuts a slice of meat from $p.", ch, corpse, NULL, TO_ROOM);
act( AT_BLOOD, "You cut a slice of meat from $p.", ch, corpse, NULL, TO_CHAR);
slice->value[0] = 25;
slice->value[0] = 13;
obj_to_char(slice, ch);
learn_from_success(ch, gsn_slice);
return;
}
There is one other thing you might want to do and thats remove the corpse after the meat has been sliced, otherwise you could slice meat for all eternity. |
Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated. | | Top |
|