24 Aug, 2010, Xrakisis wrote in the 1st comment:
Votes: 0
Hi im trying to have a given rooms mobs load from one reset instead of 1 reset 1 mob..

int x;
pReset = new_reset_data ();
x = pReset->arg2;
for (x;x<30;x++)
{
if (x == 0) pMob = create_mobile (pMobIndex);
if (x == 1) pMob = create_mobile (pMobIndex);
if (x == 2) pMob = create_mobile (pMobIndex);
if (x == 3) pMob = create_mobile (pMobIndex);
if (x == 4) pMob = create_mobile (pMobIndex);
if (x == 5) pMob = create_mobile (pMobIndex);
if (x == 6) pMob = create_mobile (pMobIndex);
if (x == 7) pMob = create_mobile (pMobIndex);
if (x == 8) pMob = create_mobile (pMobIndex);
if (x == 9) pMob = create_mobile (pMobIndex);
if (x == 10) pMob = create_mobile (pMobIndex);
if (x == 11) pMob = create_mobile (pMobIndex);
if (x == 12) pMob = create_mobile (pMobIndex);
if (x == 12) pMob = create_mobile (pMobIndex);
}


does anyone see anything wrong with his? its causing a seg fault..
-Xrakisis
24 Aug, 2010, David Haley wrote in the 2nd comment:
Votes: 0
It's near impossible without seeing more information, but maybe arg2 contains a bogus value, meaning that pMob doesn't get initialized.

What is this code even trying to do? x has a fixed value, why are you looping over possible values of x?
24 Aug, 2010, Rudha wrote in the 3rd comment:
Votes: 0
As David said, I'd need to see more of the code, but it looks like you're trying to create the same mobile 12 times. That is probably a Bad Thing unless its a prototype of some sort.

Rudha/Maya
24 Aug, 2010, Runter wrote in the 4th comment:
Votes: 0
The loop actually is ineffectual. It just adds overhead to the code being ran.

Which by the way is likely not what you want the loop to be doing.
25 Aug, 2010, chrisd wrote in the 5th comment:
Votes: 0
Xrakisis said:
if (x == 12) pMob = create_mobile (pMobIndex);
if (x == 12) pMob = create_mobile (pMobIndex);


You repeated this line…
25 Aug, 2010, Xrakisis wrote in the 6th comment:
Votes: 0
the rooms in my mud have, for example, 20 resets and load 20 mobs.
What i want is only one reset to load 20 mobs.
so while x isnt anything, it goes to thrity,
so that if the value of x is max mobs per room
then it will create that one mobile 20 times
from one reset.

thats what im trying and failing to do.
25 Aug, 2010, Runter wrote in the 7th comment:
Votes: 0
The simple answer is this.
And note that I don't know the functions name to send it to a room.
x = 20;

while(x–) char_to_room(create_mobile(pMobIndex));
25 Aug, 2010, Xrakisis wrote in the 8th comment:
Votes: 0
is there anything wrong with this?
before i put the while in it was just loading one mob per room, even with 20 existing resets.
now this(below) is what i get from trying to start it in gdb (with the while in)

could it be that a gazilian mobs are loading and its more than my ram limit can withstand?

…….
Tue Aug 24 23:22:53 2010 :: loading area104.are
Tue Aug 24 23:22:53 2010 :: loading area105.are
Tue Aug 24 23:22:53 2010 :: loading area106.are
Tue Aug 24 23:22:53 2010 :: loading sctshhgh.are
Tue Aug 24 23:22:53 2010 :: loading wild.are
Tue Aug 24 23:22:53 2010 :: {None } KaVir Wilderness
Tue Aug 24 23:22:53 2010 :: Done loading areas

Program received signal SIGTSTP, Stopped (user).
char_to_room (ch=0x2aaaabd81018, pRoomIndex=0x2aaaab8976b0) at handler.c:1372
1372 for(rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room){
(gdb) bt
#0 char_to_room (ch=0x2aaaabd81018, pRoomIndex=0x2aaaab8976b0) at handler.c:1372
#1 0x00000000004ae463 in reset_room (pRoom=0x2aaaab8976b0) at db.c:2142
#2 0x00000000004ae92c in reset_area (pArea=0x2aaaab886010) at db.c:2305
#3 0x00000000004ae063 in area_update () at db.c:1975
#4 0x00000000004aafd0 in boot_db (fCopyOver=1 '\001') at db.c:518
#5 0x000000000047daf1 in main (argc=1, argv=0x7fffffffe428) at comm.c:476
(gdb) quit


int x;
x = pReset->arg2;

for (x;x<6;x++)
{
if (x == 1) pMob = create_mobile (pMobIndex);
if (x == 2) pMob = create_mobile (pMobIndex);
if (x == 3) pMob = create_mobile (pMobIndex);
if (x == 4) pMob = create_mobile (pMobIndex);
if (x == 5) pMob = create_mobile (pMobIndex);
if (x == 6) pMob = create_mobile (pMobIndex);
}

/*
* Some more hard coding.
*/
if ( room_is_dark( pRoom ) )
SET_BIT(pMob->affected_by, AFF_INFRARED);

/*
* Pet shop mobiles get ACT_PET set.
*/
{
ROOM_INDEX_DATA *pRoomIndexPrev;

pRoomIndexPrev = get_room_index( pRoom->vnum - 1 );
if ( pRoomIndexPrev
&& IS_SET( pRoomIndexPrev->room_flags, ROOM_PET_SHOP ) )
SET_BIT( pMob->act, ACT_PET);
}

while(x–) char_to_room( pMob, pRoom );

LastMob = pMob;
level = URANGE( 0, pMob->level - 2, LEVEL_HERO );
last = TRUE;

break;
25 Aug, 2010, Kaz wrote in the 9th comment:
Votes: 0
int x; 
x = pReset->arg2;

for (x;x<6;x++)
{
if (x == 1) pMob = create_mobile (pMobIndex);
if (x == 2) pMob = create_mobile (pMobIndex);
if (x == 3) pMob = create_mobile (pMobIndex);
if (x == 4) pMob = create_mobile (pMobIndex);
if (x == 5) pMob = create_mobile (pMobIndex);
if (x == 6) pMob = create_mobile (pMobIndex);
}


Regardless of the quality of the code, if pReset->arg2 is 6 or more, then it's likely that pMob is a garbage or NULL pointer after this, depending on how it's declared. I think any other determination requires more information.
25 Aug, 2010, Igabod wrote in the 10th comment:
Votes: 0
doesn't the godwars code already provide support for 1 reset 10 mobs? I think you just have to put the max number at the end of the command you type to set the reset.
25 Aug, 2010, Sharmair wrote in the 11th comment:
Votes: 0
Though there are a number of things wrong with this code (some that others have
mentioned, though you seem to still be using), I suspect the backtrace you gave
has to do with the line:
while(x–) char_to_room( pMob, pRoom );

Where you try to put the same character in the room multiple times (and having its
next_in_room pointer pointing to itself). This, probably making that loop of the
characters in the room endless.
25 Aug, 2010, Ssolvarain wrote in the 12th comment:
Votes: 0
Igabod said:
doesn't the godwars code already provide support for 1 reset 10 mobs? I think you just have to put the max number at the end of the command you type to set the reset.


reset 1 mob 1337 20 20

Like this?
25 Aug, 2010, Xrakisis wrote in the 13th comment:
Votes: 0
when i make a reset of max mobs 10, it only loads one every area repop and one to start.
what im trynig to to is have 10 mobs from 1 reset load at once
25 Aug, 2010, Rudha wrote in the 14th comment:
Votes: 0
Try something in the vein of what Ssolvarain suggested :)

Maya/Rudha
25 Aug, 2010, Ssolvarain wrote in the 15th comment:
Votes: 0
Xrakisis said:
when i make a reset of max mobs 10, it only loads one every area repop and one to start.
what im trynig to to is have 10 mobs from 1 reset load at once


Ahh, right. I see what you mean. To get around it without touching code, you'd end up with something like this:
Resets: M = mobile, R = room, O = object, P = pet, S = shopkeeper
No. Loads Description Location Vnum Mx Mn Description
==== ======== ============= =================== ======== ===== =============
[ 1] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 2] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 3] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 4] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 5] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 6] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 7] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 8] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[ 9] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel
[10] M[ 3300] Aquaworm in room R[ 3292] 10-10 A Moldy Tunnel

which is sort of unwieldy. :P
0.0/15