ok, i'm making a new command for high level imms. this command is like steal, but only it takes an item from the player without them seeing it. i'm wanting this command to be able to take from the character's get_obj_wear list as well. here's my code so far:
i'm figuring that i need to somehow fit the
obj = get_obj_wear
in there somewhere. but i'm not sure really how to code it. any thoughts or ideas?
void do_immtake( CHAR_DATA *ch, char *argument )
{
// char buf [MAX_STRING_LENGTH];
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
// CHAR_DATA *victim, *mst;
CHAR_DATA *victim;
OBJ_DATA *obj;
// int percent;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Take what from whom?\n\r", ch );
return;
}
if ( ms_find_obj(ch) )
return;
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "That's pointless.\n\r", ch );
return;
}
if ( !str_cmp( arg1, "coin" )
|| !str_cmp( arg1, "coins" )
|| !str_cmp( arg1, "gold" ) )
{
int amount;
amount = (int) (victim->gold * number_range(1, 10) / 100);
if ( amount <= 0 )
{
send_to_char( "You couldn't get any gold.\n\r", ch );
return;
}
ch->gold += amount;
victim->gold -= amount;
ch_printf( ch, "Aha! You got %d gold coins.\n\r", amount );
return;
}
if ( ( obj = get_obj_carry( victim, arg1 ) ) == NULL )<-this is the problem i think.
{
send_to_char( "You can't seem to find it.\n\r", ch );
return;
}
separate_obj( obj );
obj_from_char( obj );
obj_to_char( obj, ch );
send_to_char( "Ok.\n\r", ch );
return;
}
i'm figuring that i need to somehow fit the
obj = get_obj_wear
in there somewhere. but i'm not sure really how to code it. any thoughts or ideas?