Sheathe/Draw SMAUG Snippet
After much frustration and fiddling I finally got my Sheath/Draw code to work for SMAUG. I'll post it here because you need a lot of the hardcoded stuff for it to work.
Feel free to ask questions or comment here or send me and email.
void do_sheath( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *w_weapon;
OBJ_DATA *w_sheath;
if( ( w_weapon = get_obj_wear( ch, argument ) ) == NULL )
{
send_to_char( "Sheath what?\r\n", ch );
return;
}
if( ( w_sheath = get_eq_char(ch, WEAR_SHEATH ) ) == NULL )
{
send_to_char("\nYou must have something to put the weapon into.\r\n", ch);
return;
}
else
{
separate_obj(w_weapon);
obj_from_char( w_weapon );
w_weapon = obj_to_obj( w_weapon, w_sheath );
ch_printf(ch, "You dextrously slide %s into %s", w_weapon->short_descr,
w_sheath->short_descr);
return;
}
}
void do_draw( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *w_weapon;
OBJ_DATA *w_sheath;
if( argument == '\0' )
{
send_to_char( "Draw what?\r\n", ch );
return;
}
if( ( w_sheath = get_eq_char(ch, WEAR_SHEATH ) ) == NULL )
{
send_to_char("\nYou don't even have a sheath to draw from.\r\n", ch);
return;
}
else
{
w_weapon = get_obj_list( ch, argument, w_sheath->first_content);
if( !w_weapon )
{
act( AT_PLAIN, "There is no $T sheathed.", ch, NULL, argument,
TO_CHAR );
return;
}
// get_obj( ch, w_weapon, w_sheath );
obj_from_obj( w_weapon );
obj_to_char( w_weapon, ch );
equip_char( ch, w_weapon, WEAR_WIELD );
ch_printf(ch, "You quickly draw %s from %s", w_weapon->short_descr,
w_sheath->short_descr);
return;
}
}
Feel free to ask questions or comment here or send me and email.
Labels: SMAUG




1 Comments:
At July 22, 2009 7:21 PM ,
Anonymous said...
Hey, nice work. Could you elaborate a bit on implementing this in Smaug? For example, how did you implement the sheaths themselves? Do you need to do anything to weapons? Where do these functions go?
I know it's been a while since you posted this, but I love the idea.
Post a Comment
Links to this post:
Create a Link
<< Home