Scavenger Mobs Help

  • slick4187
  • slick4187's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 years 10 months ago - 2 years 10 months ago #5353 by slick4187
slick4187 created the topic: Scavenger Mobs Help
So a scavenger mob picks up items off the ground, as it is now the code determins the best item then places it in the mobs inventory. This actually causes issues because it bypasses any triggers that are on the item. So Id rather it actually force the mob to use the in game command "GET" rather then auto placing the object into its inventory.

Im just having issues of actually getting it to use the in game command "GET". Here is the unmodified script as is.

Any advice anyone?

/* Scavenger (picking up objects) */
		if ( MOB_FLAGGED ( ch, MOB_SCAVENGER ) )
			if ( IN_ROOM ( ch )->contents && !number ( 0, 10 ) )
			{
				max = 1;
				best_obj = NULL;
				for ( obj = IN_ROOM ( ch )->contents; obj;
				        obj = obj->next_content )
					if ( CAN_GET_OBJ ( ch, obj ) && GET_OBJ_COST ( obj ) > max && ( ! ( IS_OBJ_STAT ( obj, ITEM_PC_CORPSE ) ) ) )
					{
						best_obj = obj;
						max = GET_OBJ_COST ( obj );
					}
				if ( best_obj != NULL )
				{
					obj_from_room ( best_obj );
					obj_to_char ( best_obj, ch );
					act ( "$n picks up $p.", FALSE, ch, best_obj, 0, TO_ROOM );
					total_actions++;
				}
			}
Last Edit: 2 years 10 months ago by slick4187.

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

More
2 years 10 months ago #5354 by WhiskyTest
WhiskyTest replied the topic: Scavenger Mobs Help
As the trigger check is done from 'perform_get_from_room()'
try something like this:
if ( best_obj != NULL )
{
   perform_get_from_room(ch, best_obj);
   total_actions++;
}

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

Time to create page: 0.847 seconds