Anyone feel like updating this skill to tba

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 months 3 weeks ago #8188 by JTP
Looks alittle like tbamud code. But not quite. If anyone feel up to the Challenge, plus make a tbamud snippet and repost.
void do_carve( struct char_data *ch, char *argument, int cmd)
{
    char arg1[MAX_STRING_LENGTH];
    char arg2[MAX_STRING_LENGTH];
    char buffer[MAX_STRING_LENGTH];
    struct obj_data *corpse;
    struct obj_data *food;
    int i,r_num;
    struct affected_type af;
  
if (!ch->skills)
	return;

if (IS_PC(ch) || IS_SET(ch->specials.act,ACT_POLYSELF))
    if (!HasClass(ch,CLASS_RANGER)) {
      send_to_char ("Hum, you wonder how you would do this...\n\r",ch);
      return;
    }
    
    if (!ch->skills[SKILL_RATION].learned)    {
      send_to_char ("Best leave the carving to the skilled.\n\r",ch);
      return;
    }
  
    half_chop(argument,arg1,arg2);
  corpse=get_obj_in_list_vis(ch,arg1,(real_roomp(ch->in_room)->contents));

    if(!corpse)  {
      send_to_char("That's not here.\n\r",ch);
      return;
    }

    if (!IS_CORPSE(corpse)) {
      send_to_char("You can't carve that!\n\r",ch);
      return;
    }

    if(corpse->obj_flags.weight<70)    {
      send_to_char("There is no good meat left on it.\n\r",ch);
      return;
    }
  
  
    if ((GET_MANA(ch) < 10) && GetMaxLevel(ch) < LOW_IMMORTAL)    {
      send_to_char ("You don't have the concentration to do this.\n\r",ch);
      return;
    }
    
  
    if (ch->skills[SKILL_RATION].learned < dice (1,101)) {
    send_to_char ("You can't seem to locate the choicest parts of the corpse.\n\r",ch);
    GET_MANA(ch) -= 5;
     LearnFromMistake(ch, SKILL_RATION, 0, 95);
     WAIT_STATE(ch, PULSE_VIOLENCE*3);
     return;
    }
  
    act("$n carves up the $p and creates a healthy ration.",FALSE,ch,corpse,0,TO_ROOM);
    send_to_char("You carve up a fat ration.\n\r",ch);
	
    if ((r_num = real_object(FOUND_FOOD)) >= 0) {
     food = read_object(r_num, REAL);
     food->name= (char *)strdup("ration slice filet food");
     sprintf(buffer,"a Ration%s",corpse->short_description+10);
     food->short_description= (char *)strdup(buffer);
     food->action_description= (char *)strdup(buffer);
     sprintf(arg2,"%s is lying on the ground.",buffer);
     food->description= (char *)strdup(arg2);
     corpse->obj_flags.weight=corpse->obj_flags.weight-50;
     i=number(1,6);
     if(i==6)
       food->obj_flags.value[3]=1;
     obj_to_room(food,ch->in_room);
     WAIT_STATE(ch, PULSE_VIOLENCE*3);
  } /* we got the numerb of the item... */
  
  }

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #8192 by WhiskyTest
Replied by WhiskyTest on topic Anyone feel like updating this skill to tba
I haven't tested this, but it should be pretty close to workable...
/* Creates and returns a new food object*/
struct obj_data *create_rations()
{
  struct obj_data *obj;
  struct extra_descr_data *new_descr;
  char buf[200];
  int y;

  
  obj = create_obj();
  CREATE(new_descr, struct extra_descr_data, 1);

 
  /* Describe the rations */
  obj->name = strdup("rations food hearty");
  obj->short_description = strdup("a hearty ration");
  obj->description = strdup("A hearty ration has been left here.");
  new_descr->keyword = strdup("rations food hearty");
  new_descr->description = strdup("It looks fit to eat, a hearty meal indeed!");
  new_descr->next = NULL;
  obj->ex_description = new_descr;
  
  /* Set object type and wear flags */
  
  GET_OBJ_TYPE(obj) = ITEM_FOOD;
  for(y = 0; y < TW_ARRAY_MAX; y++)
    obj->obj_flags.wear_flags[y] = 0;
  SET_BIT_AR(GET_OBJ_WEAR(obj), ITEM_WEAR_TAKE);
  
  /* Hours to fill tummy */
  
  GET_OBJ_VAL(obj, 0) = 5;
  /* Cost */
  GET_OBJ_COST(obj) = 1;
  obj->item_number = NOTHING;

  return (obj);
}

ACMD(do_carve)
{
    char arg1[MAX_STRING_LENGTH];
    struct obj_data *corpse, *food, *contents, *next_thing;
	int skill;
  
	if (IS_NPC(ch))
		return;

	skill = 80; // Change this to skill = GET_SKILL(ch, <desired skill>)

	one_argument(argument, arg);
	 
	if(!*arg1) {
		send_to_char(ch, "You set about carving a name for yourself in the annals of histroy.\r\n");
		return;
	}
	 
	corpse = get_obj_in_list_vis(ch, arg1, NULL, world[IN_ROOM(ch)].contents)));

    if(!corpse)  {
      send_to_char(ch, "That's not here.\n\r");
      return;
    }

    if (!IS_CORPSE(corpse)) {
      send_to_char(ch, "You can't carve that!\n\r");
      return;
    }

  
	/* Not enough moves! */
    if ((GET_MOVE(ch) < 10) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
      send_to_char (ch, "You don't have the concentration to do this.\n\r");
      return;
    }
    
  
	/* Skill failed! */
    if (dice (1,101) > skill ) {
		send_to_char (ch, "You can't seem to locate the choicest parts of the corpse.\n\r");
		GET_MOVE(ch) -= 5;
		WAIT_STATE(ch, PULSE_VIOLENCE*3);
		return;
    }
  
	/* Skill succeeded! */
    act("$n carves up the $p and creates a hearty ration.",FALSE,ch,corpse,0,TO_ROOM);
    send_to_char(ch, "You carve up a hearty ration.\n\r");

	/* Deduct the cost of the skill */
	if (!PRF_FLAGGED(ch, PRF_NOHASSLE))
		GET_MOVE(ch) -= 10;
	
	/* Some error checking in case food doesn't get created */
	if (!(food = create_rations())) {
		log("SYSERR: create_rations returns NULL object");
		send_to_char(ch, "Oh no, a wild coder just stole your rations!\r\n");
		return;
	}
	
	obj_to_char(food, ch);
	
	/* Destroy the corpse */
	for (contents = corpse->contains; contents; contents = next_thing) {
		next_thing = contents->next_content;	/* Next in inventory */
		obj_from_obj(contents);
		obj_to_room(contents, IN_ROOM(corpse));

	}
	extract_obj(corpse);
	
	WAIT_STATE(ch, PULSE_VIOLENCE*3); 	
  
  }

Please Log in or Create an account to join the conversation.

Time to create page: 1.098 seconds