Re: Im a newbie, plz help

From: Sammy (Samedi@cris.com)
Date: 12/24/96


On Mon, 23 Dec 1996, Daniel Durnin wrote:

- 1> Probably very simple to most of you, a Mob spec that makes it switch.
- You know, a mob is fighting three people, and it chooses a person different
- from the present one to start fighting.

I think it'd look something like this:

SPECIAL(switcher)
{
  struct char_data *tch;

  if(cmd)
    retrun(0);

  if(FIGHTING(ch))
    for(tch = world[ch->in_room].people; tch;tch = tch->next_in_room)
      if(tch && (tch != ch) && FIGHTING(tch) == ch && !number(0, 30)) {
	FIGHTING(ch) = tch;
	/* send messages to let people know what happened */
	break;
      }
}

The above will check to make sure the mob is fighting, and if it is, go
through the people in the room to see if it should attack someone new.

The checks are:

tch			- The target character must be valid
(tch != ch)		- The mob shouldn't be attacking itself
FIGHTING(tch) == ch 	- Only attack people attacking the mob (optional)
!number(0, 30)		- There is a 1 in 31 chance each valid person will
			  be attacked (including the person already being
			  attacked)

The 1 in 31 thing is a guess.  I think mob spec_procs are called once per
fight round, but I'm not sure.  Raise or lower this as needed.

- 2> A mob that stops players from going any exits other than the one they
- came from unless the mob gets a certain item from the PC.

This is hard to do the way you describe it.  In order to keep people from
going anywhere but the direction they came from, you have to keep track of
each person who has come into the room, whether or not they gave the item,
and which direction they can leave in.

There are a few ways you can simplify it though.  Look at the guild_guard
spec_proc.  If a room has 3 guarded exits and 1 unguarded, just modify the
guildguard to watch those 3 exits.  It'll still have to keep track of who
gave the item and who didn't, but you can hack this.  Keep the item
simple, and when someone gives it to the mob, put the player's id number
(GET_IDNUM(giver)) in one of the object value slots.  Then when someone
tries to use a guarded exit, check each item in the guard's inventory for
that player's idnum.

Sam

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST