what a player is wearing

Posted by Taebryn on Tue 24 Feb 2004 04:42 AM — 9 posts, 30,491 views.

#0
is there a way to show what a player is wielding
like when another player is in the room it says
Test the Druid is here.

i want to make it say
Test the Druid wielding a small ax is here.

how would i do this
USA #1
it would be in the do_look function

look for "stands here" or something like that, then you would need to put it like stands here wielding a %s or something. and code out what that would be. look in the look "player" section of it for that. so it's something like that. hope that helps.
USA #2
in act_info.c search for

void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch )

that is the function that shows characters in the room if you type look

there are alot of different statements that show people in the room.. about halfdway throught the function you'll see
Quote:

switch ( victim->position )
{
case POS_DEAD: strcat( buf, " is DEAD!!" ); break;
case POS_MORTAL: strcat( buf, " is mortally wounded." ); break;
case POS_INCAP: strcat( buf, " is incapacitated." ); break;
case POS_STUNNED: strcat( buf, " is lying here stunned." ); break;
case POS_SLEEPING:
if (ch->position == POS_SITTING
|| ch->position == POS_RESTING )
strcat( buf, " is sleeping nearby." );
else
strcat( buf, " is deep in slumber here." );
break;
case POS_RESTING:
if (ch->position == POS_RESTING)
strcat ( buf, " is sprawled out alongside you." );
else
if (ch->position == POS_MOUNTED)
strcat ( buf, " is sprawled out at the foot of your mount." );
else
strcat (buf, " is sprawled out here." );
break;
case POS_SITTING:
if (ch->position == POS_SITTING)
strcat( buf, " sits here with you." );
else
if (ch->position == POS_RESTING)
strcat( buf, " sits nearby as you lie around." );
else
strcat( buf, " sits upright here." );
break;
case POS_STANDING:
if ( IS_IMMORTAL(victim) )
strcat( buf, " is here before you." );
else
if ( ( victim->in_room->sector_type == SECT_UNDERWATER )
&& !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
strcat( buf, " is drowning here." );
else
if ( victim->in_room->sector_type == SECT_UNDERWATER )
strcat( buf, " is here in the water." );
else
if ( ( victim->in_room->sector_type == SECT_OCEANFLOOR )
&& !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
strcat( buf, " is drowning here." );
else
if ( victim->in_room->sector_type == SECT_OCEANFLOOR )
strcat( buf, " is standing here in the water." );
else
if ( IS_AFFECTED(victim, AFF_FLOATING)
|| IS_AFFECTED(victim, AFF_FLYING) )
strcat( buf, " is hovering here." );
else
strcat( buf, " is standing here." );
break;
case POS_SHOVE: strcat( buf, " is being shoved around." ); break;
case POS_DRAG: strcat( buf, " is being dragged around." ); break;
case POS_MOUNTED:
strcat( buf, " is here, upon " );
if ( !victim->mount )
strcat( buf, "thin air???" );
else
if ( victim->mount == ch )
strcat( buf, "your back." );
else
if ( victim->in_room == victim->mount->in_room )
{
strcat( buf, PERS( victim->mount, ch ) );
strcat( buf, "." );
}
else
strcat( buf, "someone who left??" );
break;
case POS_FIGHTING:
case POS_EVASIVE:
case POS_DEFENSIVE:
case POS_AGGRESSIVE:
case POS_BERSERK:
strcat( buf, " is here, fighting " );
if ( !victim->fighting )
{
strcat( buf, "thin air???" );

/* some bug somewhere.... kinda hackey fix -h */
if(! victim->mount)
victim->position = POS_STANDING;
else
victim->position = POS_MOUNTED;
}
else if ( who_fighting( victim ) == ch )
strcat( buf, "YOU!" );
else if ( victim->in_room == victim->fighting->who->in_room )
{
strcat( buf, PERS( victim->fighting->who, ch ) );
strcat( buf, "." );
}
else
strcat( buf, "someone who left??" );
break;

you'll have to change any of the cases that you want to display the name of the weapon. if you just want "standing here"
you'd change that strcat(buf, " is standing here." );
to
Quote:

{
wield = get_eq_char( ch, WEAR_WIELD );
if (wield)
sprintf(buf, " is standing here, wielding %s", weild->short_descr );
else
strcat(buf, " is standing here." );
}

and add
OBJ_DATA *wield;
to the top of the function.
this is just something to go by.. it doesnt including dual wielding or anything.. have fun :)
#3
thanks a bunch, i can work off this
#4
i tried what you said, but it is not recognizing
OBJ_DATA *wield;

cant find "wield"
Canada #5
If it can't find wield, then its likely declared in the wrong place. Go to the top of the function, where the other declarations are, and add it with those. If you add it below an instruction, then it will not work.
#6
void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch )
{
OBJ_DATA *wield;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];

............

else
//strcat( buf, " is standing here." );
{
wield = get_eq_char( ch, WEAR_WIELD );
if (wield)
sprintf(buf, " is standing here, wielding %s", weild->short_descr );
else
strcat(buf, " is standing here." );
}


and i get the errors:
C:\Documents and Settings\Sam\My Documents\MUDs\reign of arthur\source\act_info.c(671) : error C2065: 'weild' : undeclared identifier
C:\Documents and Settings\Sam\My Documents\MUDs\reign of arthur\source\act_info.c(671) : error C2223: left of '->short_descr' must point to struct/union
Amended on Wed 03 Mar 2004 02:06 AM by Taebryn
Canada #7
if you look at the error, you'll notice "error C2065: 'weild' : ". You've spelt wield wrong.
#8
hahahah, I knew that! :X
thx