Re: Dynamic Shops

From: Mythran (kip_potter@hotmail.com)
Date: 10/23/02


From: "David Cole" <tiznor@SOFTHOME.NET>
> I've rewritten the entire shop system to work in a completely different way.
> First off if a mob is mob flagged as MOB_SHOPKEEPER then it is a shop
> keeper. Second what ever is in the mobs inventory is what is he selling,
> with certain perks and checks and what not.
>
> the problem I seem to be having is in my for() loop to check if a mob in a
> room is actually a shop keeper:
>

>   for (tch = world[ch->in_room].people; tch; tch = next_tch) {
>     next_tch = tch->next_in_room;
>
>  if (IS_PC(tch))
>    continue;
>
>     if (!MOB_FLAGGED(tch, MOB_SHOPKEEPER)) {
>       send_to_char("You can't do that here!\r\n", ch);
>       return;
>  }

at the top of this function place int found_shopkeeper = FALSE;

for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
  if (IS_PC(tch))
    continue;

  if (!MOB_FLAGGED(tch, MOB_SHOPKEEPER))
    continue;

  found_shopkeeper = TRUE;

  bla bla bla....
}

if (!found_shopkeeper) {
  send_to_char(ch, "You can't do that here!\r\n", ch);
  return;
}


HOpe it helps :)

Mythran

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT