Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Generate an act flag on mobile, on reset area
Generate an act flag on mobile, on reset area
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Tue 27 Jul 2004 11:18 PM (UTC) |
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 | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #1 on Wed 28 Jul 2004 06:45 AM (UTC) |
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 | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #2 on Wed 28 Jul 2004 06:58 AM (UTC) 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 | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #3 on Fri 30 Jul 2004 05:09 PM (UTC) |
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 | 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.
11,819 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top