Re: [ Idea, Problem? ] Mobprogs and Variables...

From: Gary Barnett (gbarnett@POLARNET.COM)
Date: 09/25/97


On Thursday, September 25, 1997 12:49 PM, David Klasinc
[SMTP:bigwhale@CAPYBARA.SK-PTTSC.LJ.EDUS.SI] wrote:
> On Thu, 25 Sep 1997, Justin wrote:
>
> > And do what then?  Have the mob react differently according to the value
> > you stored, gold in your example?  I haven't done that, but I was going
> > to
> ... snip snip ...
> > skills, using values such as manapool and hitpoints, "decide" how often
> > and which spells/skills to use, or when to run.
> >
> > If that's not the type of thing you're thinking about, I really don't
> > understand what you are talking about. :)
>
> Ok.. Here's the example that I got from the builders... :)
>
> There is a kidnapped princes... You go and save her..
> When you save her, your name is stored into one of her variables...
>

Enter Program (princess):
$q! 4000
  talk $n You saved me!
  QSET $n 4000
  %x
$endif
$q! 4001
  talk $n You really should take me to the King, you know....
$endif

> Then you bring her back to the king... And she says Hello Papa, this is $v
> my hero!
> and then she does somethign like give <award> $v
>
> Where $v is the thing from the first variable :)
>
Enter Program (for king)

$q= 4000
   $q= 4001
        talk $n You've already received this award!
        %x
   $endif
   MGET mob <princess_mob_vnum>
   $l= 0
      talk $n Umm.. You forgot to bring the princess.
      %x
   $endif
   QSET $n 4001
   talk $n Thanks for saving the princess!
   <create reward>
   <give reward>
$endif


That's how I'd do that on my mud using my mob scripting language.

As far as regular mob progs, all you need is the MGET, QSET and the
test for a person having a QBIT.

A QBIT is a linked list of sh_int's stored on a player, and saved when
they rent.

struct qbit_data {
   sh_int number;
   struct qbit_data *next;
};

Each player gets a pointer to their qbit list..

int get_qbit(struct char_data *ch, int which_bit) {
   struct qbit_data *qbit;

   if (ch->player_specials->qbits)
     for(qbit=ch->player_specials->qbits;qbit;qbit=qbit->next)
       if (qbit->number = which_bit)
          return 1;
  return 0;
}

void set_qbit(struct char_data *ch, int which_bit) {
   struct qbit_data *qbit;

   if (get_qbit(ch, which_bit))
      return;

   CREATE(qbit, struct qbit_data, 1);
   if (!ch->player_specials->qbits) {
      qbit->next=0;
      ch->player_specials->qbits = qbit;
   } else {
      qbit->next = ch->player_specials->qbits;
      ch->player_specials->qbits = qbit;
   }
   qbit->number = which_bit;
}

MGET is a lookup function for several things. In this script it
was used to determine if a mob (the princess) was in the
room. Shouldn't be too hard to add that to mobprogs.

The idea is that info like that is stored on the player, as
opposed to the mob. I do have a system I call ABITs which
are the same as qbits, except that mobs and players have
pointers to their lists and they are purged when the player
rents or the mob/player dies.

Hope this helped..

--Mallory


I can picture in my mind a world without war, a world without hate.
And I can picture us attacking that world, because they'd never
expect it.     - Jack Handey


     +------------------------------------------------------------+
     | 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