You're missing a couple of { and }'s at the end where you check if
message!=NULL.
Furthermore, I'm not sure if your for-loop in combination with the
if-statement intern does make sense, since it returns when the
first character in the room is an NPC.
Anyway, try something like this:
// search for a player
for (vch=ch->in_room->people;vch!=NULL;vch=vch->next_in_room)
if (!IS_NPC(vch)) break;
// none found, exit
if (vch==NULL)
return FALSE;
// 60% chance it doesn't get woken up.
if (number_percent()<60)
return FALSE;
// *cheer mob*
act($n roars in pain as it is accidently stepped upon and ATTACKS!",
ch,NULL,vch,TO_ALL);
multi_hit(ch,vch,TYPE_UNDEFINED);
return TRUE;
oh yeah, // is a bad way of commenting if you're not using C++ :-P
Edwin, for (vch=ch->in_room->people;vch!=NULL &&
IS_NPC(vch);vch=vch->next_in_room) ;
On Thu, Jan 24, 2002 at 05:41:40PM -0800, TandonMiir wrote:
> This is a section of a special I'm writing for a mob, and at this point only
> works because of "ch == vch", which I have tested by trying "ch != vch".
>
> The problem is that the act line fires and then nothing happens... obiously
> the vch is an invalid target. and if ch == vch, then it's trying to kill
> itself. Not the best way to go about it.
>
> How can I prevent vch from being assigned to the mob?
>
>
> /* see if PC in room, then give 1 in 2.5 chance of waking */
> for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
> {
> if (!IS_NPC(vch) || ch == vch)
> {
> switch (number_range(1,5))
> {
> default: message = NULL; break;
> case 1: case 3:
> message = "$n roars in pain as it is accidently stepped upon
> and ATTACKS!.";
> break;
> }
> }
> else
> {
> return FALSE;
> }
> }
>
> if (message != NULL)
> act(message,ch,NULL,vch,TO_ALL);
> multi_hit( ch, vch, TYPE_UNDEFINED );
> return TRUE;
>
> if (message == NULL)
> return FALSE;
> }
>
>
> ~Tandon
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
--
Edwin Groothuis | Personal website: http://www.MavEtJu.org
[EMAIL PROTECTED] | Interested in MUDs? Visit Fatal Dimensions:
------------------+ http://www.FatalDimensions.org/