[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Generate an act flag on mobile, on reset area

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Generate an act flag on mobile, on reset area

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Tue 27 Jul 2004 11:18 PM (UTC)  quote  ]
Message
Okay, what I want to do, is every area reset, the code will go through all the mobs with certain ifchecks, and a random chance. If all is true, it will set an act flag on the mobs. I've nearly done this, except for that if the mob is already in the area, it won't set it. Here's the code, in reset.c, reset_area:


      if ( pMobIndex->count >= pReset->arg2 )
      {
        mob = NULL;
        break;
      }

      mob = create_mobile(pMobIndex);

        chance = number_range( 0, 25 );
        if ( chance == 24 && !xIS_SET(mob->act, ACT_PACIFIST ) && !xIS_SET(mob->act, ACT_SHARD_NEVER ) &&
                   !xIS_SET(mob->act, ACT_PROTOTYPE ) )
        {
          sprintf ( buf, "Loading shard on %s.", mob->name );
          to_channel( buf, CHANNEL_SHARDMONITOR, "ShardMonitor", LEVEL_SUB_IMPLEM );
          xSET_BIT(mob->act, ACT_HAS_SHARD);
          mob->hitroll *= 2;
          mob->damroll *= 2;
        }

      {
        ROOM_INDEX_DATA *pRoomPrev = get_room_index(pReset->arg3 - 1);

        if ( pRoomPrev && IS_SET(pRoomPrev->room_flags, ROOM_PET_SHOP) )
          xSET_BIT(mob->act, ACT_PET);
      }
      if ( room_is_dark(pRoomIndex) )
          xSET_BIT(mob->affected_by, AFF_INFRARED);


Now the flag will be set if the mob isn't in the area, and there's a reset for it, but not if the mob is not in the area. How do I change this, so it will check/set all mobs?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #1 on Wed 28 Jul 2004 06:45 AM (UTC)  quote  ]
Message
Yeah, I know why its not working. You have that check in the section of code that creates mobs. If the mob doesn't need to be created, then this check will be completely missed. You probably want something above the check for if it should create it or not. Like in here:
      if ( pMobIndex->count >= pReset->arg2 )
      {
        /* here would work, I think, you just have to use each instance of the mob from here */
        mob = NULL;
        break;
      }


Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #2 on Wed 28 Jul 2004 06:58 AM (UTC)  quote  ]

Amended on Wed 28 Jul 2004 07:05 AM (UTC) by Zeno

Message
Doesn't work. The mob is null.


#0  0x08104e84 in reset_area (pArea=0x8350b60) at reset.c:1358
1358                xSET_BIT(mob->act, ACT_HAS_SHARD);
(gdb) bt
#0  0x08104e84 in reset_area (pArea=0x8350b60) at reset.c:1358
#1  0x08102e2b in edit_reset (ch=0x8372438, argument=0xbffff2ba "", pArea=0x8350b60, aRoom=0x0) at reset.c:429
#2  0x08104823 in do_reset (ch=0x8372438, argument=0xbffff2b6 "area") at reset.c:1072
#3  0x080d38ac in interpret (ch=0x8372438, argument=0xbffff2b6 "area") at interp.c:557
#4  0x080a9183 in game_loop () at comm.c:671
#5  0x080a8ab1 in main (argc=2, argv=0xbffff6d0) at comm.c:304
#6  0x42015967 in __libc_start_main () from /lib/i686/libc.so.6

(gdb) print mob
$1 = (struct char_data *) 0x0



      if ( pMobIndex->count >= pReset->arg2 )
      {
//        chance = number_range( 0, 25 );
//        if ( chance == 24 && !xIS_SET(mob->act, ACT_PACIFIST ) && !xIS_SET(mob->act, ACT_SHARD_NEVER ) &&
//                   !xIS_SET(mob->act, ACT_PROTOTYPE ) )
//          {
            sprintf ( buf, "Loading shard on %s.", mob->name );
            to_channel( buf, CHANNEL_SHARDMONITOR, "ShardMonitor", LEVEL_SUB_IMPLEM );
            xSET_BIT(mob->act, ACT_HAS_SHARD);
            mob->hitroll *= 2;
            mob->damroll *= 2;
//          }
        mob = NULL;
        break;
      }

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #3 on Fri 30 Jul 2004 05:09 PM (UTC)  quote  ]
Message
I thought it might be a few mobs that were null, so I made an ifcheck if ( mob ) but it didn't find any mobs at all that time. reset_area is the only function that this would work on I think, but I can't seem to get it to work.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,334 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]