Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex, Google

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » Wandering Mobs.
Forum Rules | Mark all | Recent Posts

Wandering Mobs.
< Newer Topic :: Older Topic > How do you keep mobs from wandering

Pages:<< prev 1 next >>
Post is unread #1 Mar 15, 2008, 7:19 pm
Go to the top of the page
Go to the bottom of the page

ChrisBailey
Fledgling
GroupMembers
Posts11
JoinedMar 15, 2008

Hmm, how exactly do you keep mobs from wandering out of an area and into the overland map? I figured stayarea would do it but it doesn't seem to work.. I'm sure the sentinel flag would work, but I want them to wander around the area =)
       
Post is unread #2 Mar 15, 2008, 7:37 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Use the stayarea flag (I think)
       
Post is unread #3 Mar 15, 2008, 7:39 pm
Go to the top of the page
Go to the bottom of the page

ChrisBailey
Fledgling
GroupMembers
Posts11
JoinedMar 15, 2008

Yeah that's what I'm using right now but it just isn't working for some reason =(
       
Post is unread #4 Mar 15, 2008, 7:47 pm
Go to the top of the page
Go to the bottom of the page

ChrisBailey
Fledgling
GroupMembers
Posts11
JoinedMar 15, 2008

Egads! They seem to have stopped wandering but now using stat mob (that mob in particular) causes a seg fault followed by
warning: Can't read pathname for load map: Input/output error.
       
Post is unread #5 Mar 15, 2008, 10:45 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Nice.. g'luck with that one. The solution we came up with on our mud for keeping mobs in their assigned areas was to give exits between areas the nomob flag (which I modified to ignore pets). I'm pretty sure that the fact that the stayarea flag doesn't work has been noted before here, whether or not it's ever been addressed, I can't say though.
       
Post is unread #6 Mar 15, 2008, 11:42 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Realizing that this isn't smaug code, and probably looks nothing like it, this seems to work in my old mud.
      if (!IS_SET(ch->specials.act, ACT_STAY_ZONE) ||
          (rp->zone == real_roomp(ch->in_room)->zone)) {
        ch->specials.last_direction = door;
        go_direction(ch, door);
      }


For me, that's in a function called mobile_wander(), which is part of mobile_activity(). Somewhere in there, there should be something similar that checks to see if your current zone and your exit's zone are different.
       
Post is unread #7 Mar 16, 2008, 5:42 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

In AFK (at least 2.03, checked it yesterday) it sort of works, the stay area flag shouldn't let them go from one area to the next, it is with the addition of the map part that it doesn't check to see if they are allowed to leave the area they are in. This is from update.cpp in function mobile_update
      /*
       * Map wanderers - Samson 7-29-00 
       */
      if( ch->has_actflag( ACT_ONMAP ) )
      {
         short sector = get_terrain( ch->map, ch->mx, ch->my );
         short map = ch->map;
         short x = ch->mx;
         short y = ch->my;
         short dir = number_bits( 5 );

         if( dir < DIR_SOMEWHERE && dir != DIR_UP && dir != DIR_DOWN )
         {
            switch ( dir )
            {
               default:
                  break;
               case DIR_NORTH:
                  if( map_wander( ch, map, x, y - 1, sector ) )
                     move_char( ch, NULL, 0, DIR_NORTH, false );
                  break;
               case DIR_NORTHEAST:
                  if( map_wander( ch, map, x + 1, y - 1, sector ) )
                     move_char( ch, NULL, 0, DIR_NORTHEAST, false );
                  break;
               case DIR_EAST:
                  if( map_wander( ch, map, x + 1, y, sector ) )
                     move_char( ch, NULL, 0, DIR_EAST, false );
                  break;
               case DIR_SOUTHEAST:
                  if( map_wander( ch, map, x + 1, y + 1, sector ) )
                     move_char( ch, NULL, 0, DIR_SOUTHEAST, false );
                  break;
               case DIR_SOUTH:
                  if( map_wander( ch, map, x, y + 1, sector ) )
                     move_char( ch, NULL, 0, DIR_SOUTH, false );
                  break;
               case DIR_SOUTHWEST:
                  if( map_wander( ch, map, x - 1, y + 1, sector ) )
                     move_char( ch, NULL, 0, DIR_SOUTHWEST, false );
                  break;
               case DIR_WEST:
                  if( map_wander( ch, map, x - 1, y, sector ) )
                     move_char( ch, NULL, 0, DIR_WEST, false );
                  break;
               case DIR_NORTHWEST:
                  if( map_wander( ch, map, x - 1, y - 1, sector ) )
                     move_char( ch, NULL, 0, DIR_NORTHWEST, false );
                  break;
            }
         }
         if( ch->char_died(  ) )
            continue;
      }

That is the part that you will probably need to modify to take into consideration on the stayarea flag somehow. I haven't looked at the overland code since around AFK 1.7 or so, so no clue of the best way to go about it. I would think that if they are in a normal area though they shouldn't have the onmap flag set, so it might come from the part below not taking into consideration that a map should be treated different.
      /*
       * Wander 
       * Update hunt_vic also if any changes are made here 
       */
      if( !ch->has_actflag( ACT_SENTINEL )
          && !ch->has_actflag( ACT_PROTOTYPE )
          && ( door = number_bits( 5 ) ) <= 9 && ( pexit = ch->in_room->get_exit( door ) ) != NULL && pexit->to_room
          /*
           * && !IS_EXIT_FLAG( pexit, EX_CLOSED ) - Test to see if mobs will open doors like this. 
           */
          && !IS_EXIT_FLAG( pexit, EX_WINDOW )
          && !IS_EXIT_FLAG( pexit, EX_NOMOB )
          /*
           * Keep em from wandering through my walls, Marcus 
           */
          && !IS_EXIT_FLAG( pexit, EX_FORTIFIED )
          && !IS_EXIT_FLAG( pexit, EX_HEAVY )
          && !IS_EXIT_FLAG( pexit, EX_MEDIUM )
          && !IS_EXIT_FLAG( pexit, EX_LIGHT )
          && !IS_EXIT_FLAG( pexit, EX_CRUMBLING )
          && !pexit->to_room->flags.test( ROOM_NO_MOB )
          && !pexit->to_room->flags.test( ROOM_DEATH )
          && ( !ch->has_actflag( ACT_STAY_AREA ) || pexit->to_room->area == ch->in_room->area ) )
      {
         if( pexit->to_room->sector_type == SECT_WATER_NOSWIM && !ch->has_aflag( AFF_AQUA_BREATH ) )
            continue;

         if( pexit->to_room->sector_type == SECT_RIVER && !ch->has_aflag( AFF_AQUA_BREATH ) )
            continue;

         if( IS_EXIT_FLAG( pexit, EX_CLOSED ) && !pexit->to_room->flags.test( ROOM_NO_MOB ) )
            cmdf( ch, "open %s", pexit->keyword );
         retcode = move_char( ch, pexit, 0, pexit->vdir, false );

         /*
          * If ch changes position due to it's or some other mob's movement via MOBProgs, continue - Kahn 
          */
         if( ch->char_died(  ) )
            continue;

         if( retcode != rNONE || ch->has_actflag( ACT_SENTINEL ) || ch->position < POS_STANDING )
            continue;
      }

That is just to show that the normal room moving in AFK does make use of the stay area flag.
       
Post is unread #8 Mar 16, 2008, 9:39 am
Go to the top of the page
Go to the bottom of the page

ChrisBailey
Fledgling
GroupMembers
Posts11
JoinedMar 15, 2008

Ah, I will play around with it a bit this evening and post a fix. Unless everyone has already taken care of it themselves. :)
Thanks guys.
       
Post is unread #9 Mar 16, 2008, 3:16 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

My head builder tells me that our solution used to involve nomob flags but we've apparently switched to using nowander flags with the stayarea flags because, it seems, the stayarea flags only work for mobs that also have the nowander flag. *shrug*

If you come up with a fix, I'd post it regardless of whether anyone else has found a work-around or not, it's kind of what this site is all about. :wink:
       
Post is unread #10 Mar 20, 2008, 1:37 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

The stayarea flag should be working though. The overland is in a different area than normal zones, unless of course someone added new rooms to the area file with the continent's map room in it and stuck their mobs in that. Then yes, you'd have issues with it working "properly" because the code would see it as being in the same place.

Being on the same continent has no bearing on this, just to keep that clear.

So what I'd need to know is this: Is the room that the mob is wandering off from part of the same area the overland room is in? If not, then could you provide a test case for me to play with? IE: What you set up, what flags everything used, so I can try to replicate it.
       
Pages:<< prev 1 next >>