Re: mobprogs

From: ;P (siv@CYBERENET.NET)
Date: 12/18/97


> im not exaclty sure of all of it myself, but i think if you look at from as
> a percent, you will realize that if you set a rand_prog to 100%, the mob
> will be saying or doing whatever command you gave him nonstop until it dies
> (100% of the time he is in existence). of course, rand_progs can be set to
> a value less than 100%, and as a result will lessen the frequency of
> whatever command you gave him.

uh..first of all, in stock mobprogs the random progs are checked every
ten seconds (in mobile_activity), so having one set to one hundred only
means that it will fire off every ten seconds (not constantly, like was
implied)

> this does not always deal with rand_prog..... any program that needs a
> percent cannot go over 100%, and when several programs are used they must
> be divied among the 100%..
> hope this helps,

this is false, but not by much...actually what happens is that it checks
the first random prog, and if it succeeds, then it breaks, not checking
any of the remaining progs..i believe that it says that somewhere in the
docs, but even if it didn't, then you could figure it out by tracing the
code to this:

void mprog_percent_check(struct char_data *mob, struct char_data *actor, struct obj_data *obj,
                         void *vo, int prog_type)
{
  MPROG_DATA *mprg;

  for (mprg = mob_index[mob->nr].mobprogs; mprg != NULL; mprg = mprg->next)
    if ((mprg->type & prog_type)
        && (number(0, 100) < atoi(mprg->arglist))) {
      mprog_driver(mprg->comlist, mob, actor, obj, vo);
      if (prog_type != GREET_PROG && prog_type != ALL_GREET_PROG)
        break;
    }
  return;
}

notice that it will break upon success unless it is a GREET_PROG or an
ALL_GREET_PROG..

the order in which the random progs appear does matter then..because if
you have a 2% prog after a 100% prog..then you will never see the 2%
prog because the first one will always succeed and break you out of
the check..so if you want a 50/50 chance between progs..then you have to
have the first one set at 50%..and the second one set at 100% (if it
were 50, as dmitri said, then you would only have a 25% chance of it
firing off ever..and the other 25% nothing would happen..)

i usually make sure that the random progs appear in ascending order of
percent chance, to make sure that none of them will be eclipsed..

siv


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



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