I'm having some trouble adding a new mob number variable. So far I have put it in mob_index_data and char_data (in mud.h). I can edit it, and seems to work fine, but when I savearea, and copyover(or reboot) its back to the original value, 0. I'm missing the place to save it at, and I'm not sure how or where it is. I've never added a mob variable yet, so I guess I need help.
Adding new mob variable
Posted by Zeno on Sun 31 Aug 2003 04:18 AM — 37 posts, 108,820 views.
You need to add it to both the save and load routines, in db.c I think it is. Be cautious how you do it, if you are not careful existing area files will not be able to be read, and also the area editor, or other offline editing tools will not read the area either.
The save section is in the function fold_area() which is usually found in build.c but may be in db.c as well. The load section is in the function load_mobiles() in db.c
Adding new variables to a mud can be a tricky situation. The problem is once you've added the 'load' code, the mud expects to find that variable no matter what. I personally have 2 methods of adding new variables into an area file.
The first method is a little simpler but a little easier to screw up too.
The first thing you should do is add the 'save' code to build.c so that your new variable will be written to the area file. For example:
A portion of my code in fold_area() looks like this:
I'm going to add my new code between the two for refrence.
Now assuming all of the rest of the code related to this new var is complete (minus the load code!) I'm going to recompile and run my mud.
Now I run 'foldarea all' to ensure that all of my areas now have saved SOMETHING (even a 0 is fine) to that new location. This now ensures that when I add the load code, the area files have something in the spot the mud expects to find a variable.
Then you add your load code to db.c. Recompile and restart your mud. Since the area files have been preped you should be good to go.
When adding your load code you need to ensure it's in the exact spot as where you saved it. For example:
This is a chunck of code from my load_mobiles() in db.c:
That looks like its loading the variables that I used as refrence for saving. So I'll add my new variable in between.
Now I should have all of the code installed to save/load my new variable. This is my preffered method for simple additions because it cuts down on code. The other method is to use an 'area version' for the area files and a series of if checks to ensure a section of code is only loaded if it's a compatible version. But the above example should suit most needs. Hope this helps.
-Bobo
Adding new variables to a mud can be a tricky situation. The problem is once you've added the 'load' code, the mud expects to find that variable no matter what. I personally have 2 methods of adding new variables into an area file.
The first method is a little simpler but a little easier to screw up too.
The first thing you should do is add the 'save' code to build.c so that your new variable will be written to the area file. For example:
A portion of my code in fold_area() looks like this:
fprintf( fpout, "%d 0\n", pMobIndex->gold );
fprintf( fpout, "%d %d %d\n", pMobIndex->position,
pMobIndex->defposition,
pMobIndex->sex );
I'm going to add my new code between the two for refrence.
fprintf( fpout, "%d 0\n", pMobIndex->gold );
fprintf( fpout, "%d\n", pMobIndex->newvar );
fprintf( fpout, "%d %d %d\n", pMobIndex->position,
pMobIndex->defposition,
pMobIndex->sex );
Now assuming all of the rest of the code related to this new var is complete (minus the load code!) I'm going to recompile and run my mud.
Now I run 'foldarea all' to ensure that all of my areas now have saved SOMETHING (even a 0 is fine) to that new location. This now ensures that when I add the load code, the area files have something in the spot the mud expects to find a variable.
Then you add your load code to db.c. Recompile and restart your mud. Since the area files have been preped you should be good to go.
When adding your load code you need to ensure it's in the exact spot as where you saved it. For example:
This is a chunck of code from my load_mobiles() in db.c:
pMobIndex->gold = fread_number( fp );
pMobIndex->exp = fread_number( fp );
pMobIndex->position = fread_number( fp );
pMobIndex->defposition = fread_number( fp );
That looks like its loading the variables that I used as refrence for saving. So I'll add my new variable in between.
pMobIndex->gold = fread_number( fp );
pMobIndex->newvar = fread_number( fp );
pMobIndex->exp = fread_number( fp );
pMobIndex->position = fread_number( fp );
pMobIndex->defposition = fread_number( fp );
Now I should have all of the code installed to save/load my new variable. This is my preffered method for simple additions because it cuts down on code. The other method is to use an 'area version' for the area files and a series of if checks to ensure a section of code is only loaded if it's a compatible version. But the above example should suit most needs. Hope this helps.
-Bobo
There is another way, which is what I meant by being careful. ;)
If you add writing the new variable to an *existing* line, you can then use sscanf to read it in, like this example from db.c:
Now if you wanted to read another one you could do this:
The advantage of this method is that it will cope with existing area files because the non-present variable will be taken to be zero.
If you add writing the new variable to an *existing* line, you can then use sscanf to read it in, like this example from db.c:
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7 );
pMobIndex->race = x1;
pMobIndex->class = x2;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
Now if you wanted to read another one you could do this:
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8 );
pMobIndex->race = x1;
pMobIndex->class = x2;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
pMobIndex->my_new_variable = x8;
The advantage of this method is that it will cope with existing area files because the non-present variable will be taken to be zero.
True. But I was trying to demonstrate a way that could be used with strings too. ;-)
Ok I followed Nick's advice, because I've done this before and was getting errors in mobs because the variable wasn't created in the mobs.
In db.c
Looks ok, right? Well, I loadarea, mset the mobs new variable to 1, savearea, copyover/reboot, loadarea, and stat the mob. The variable is back to 0. Maybe I did the mset wrong.
In build.c
By the way, value2 is "unsigned long long" and is defined as
What am I doing wrong?
In db.c
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8 );
pMobIndex->race = x1;
pMobIndex->class = x2;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
pMobIndex->mvr = x8;
Looks ok, right? Well, I loadarea, mset the mobs new variable to 1, savearea, copyover/reboot, loadarea, and stat the mob. The variable is back to 0. Maybe I did the mset wrong.
In build.c
if ( !str_cmp( arg2, "mvr" ) )
{
if ( !IS_NPC(victim) )
return;
victim->mvr = value2;
if ( IS_NPC(victim) && xIS_SET(victim->act, ACT_PROTOTYPE) )
victim->pIndexData->mvr = value2;
return;
}
By the way, value2 is "unsigned long long" and is defined as
value2 = is_number( arg3 ) ? atof( arg3 ) : -1;
What am I doing wrong?
You're loading it ok. But where are you saving it at? Have you added your new variable to fold_area in build.c? It should look something like this:
fprintf( fpout, "%d 0 %d %d %d %d %d\n",
pMobIndex->race,
pMobIndex->height,
pMobIndex->weight,
pMobIndex->speaks,
pMobIndex->speaking,
pMobIndex->numattacks,
pMobIndex->mvr );
Well, I tried that and didn't work.
Why a zero? And I'm not foldarea, I'm savearea, copyover/reboot, loadarea. I want the variable to stay when its prototype.
fprintf( fpout, "%d 0 %d %d %d %d %d %d\n",
pMobIndex->race,
pMobIndex->class,
pMobIndex->height,
pMobIndex->weight,
pMobIndex->speaks,
pMobIndex->speaking,
pMobIndex->numattacks,
pMobIndex->mvr );
Why a zero? And I'm not foldarea, I'm savearea, copyover/reboot, loadarea. I want the variable to stay when its prototype.
The 0 is there because stock smaug saves the mob's class even though mobs don't have classes (fighter, cleric, ect.)
I realize you are using savearea but the fold_area function is used by savearea to actually save the file itself. If you used Nick's example correctly and my example correctly you should be set. How are you modifing the variable itself? Did you setup something in mset or a seperate command?
I realize you are using savearea but the fold_area function is used by savearea to actually save the file itself. If you used Nick's example correctly and my example correctly you should be set. How are you modifing the variable itself? Did you setup something in mset or a seperate command?
well, your using an unsigned long long, right? I don't think it can be written in with %d, as you are using in fold_area, but you would need %lu, you would need to change it to:
Now, I might be wrong, but I beleive that %lu would make it print in the proper format. If I am wrong, someone please correct me, as I was able to find that %lu is for unsigned longs, but I don't know if it would make a difference with unsigned long longs
fprintf( fpout, "%d 0 %d %d %d %d %d %lu\n",
pMobIndex->race,
pMobIndex->class,
pMobIndex->height,
pMobIndex->weight,
pMobIndex->speaks,
pMobIndex->speaking,
pMobIndex->numattacks,
pMobIndex->mvr );
Now, I might be wrong, but I beleive that %lu would make it print in the proper format. If I am wrong, someone please correct me, as I was able to find that %lu is for unsigned longs, but I don't know if it would make a difference with unsigned long longs
Uh, my original code was
There wasn't a 0. So you want me to add it?
Oh, and Grevan, yeah, good thought. Except its %llu.
Boborak, your example, do you mean your first example? I've added Nick's careful way, and then your way to save the variable. Should I have added your first example too? And btw, I used mset to change the variable. I posted the code in my above post.
fprintf( fpout, "%d %d %d %d %d %d %d\n",
pMobIndex->race,
pMobIndex->class,
pMobIndex->height,
pMobIndex->weight,
pMobIndex->speaks,
pMobIndex->speaking,
pMobIndex->numattacks );
There wasn't a 0. So you want me to add it?
Oh, and Grevan, yeah, good thought. Except its %llu.
Boborak, your example, do you mean your first example? I've added Nick's careful way, and then your way to save the variable. Should I have added your first example too? And btw, I used mset to change the variable. I posted the code in my above post.
Ah. I stand corrected. The 0 is not stock SMAUG. I was using an example from my code. Leave it at %d.
My apoligies, I copied the wrong part, and thanks, wasn't sure about %llu.
Alright, its now...
Still reseting to 0 on copyover/reboot. The above would be my savearea code, this is the mset code
value2 allows me to mset it higher than 2billion, the code is
And then in db.c
fprintf( fpout, "%d %d %d %d %d %d %d %llu\n",
pMobIndex->race,
pMobIndex->class,
pMobIndex->height,
pMobIndex->weight,
pMobIndex->speaks,
pMobIndex->speaking,
pMobIndex->numattacks,
pMobIndex->mvr );
Still reseting to 0 on copyover/reboot. The above would be my savearea code, this is the mset code
if ( !str_cmp( arg2, "mvr" ) )
{
if ( !IS_NPC(victim) )
return;
victim->mvr = value2;
if ( IS_NPC(victim) && xIS_SET(victim->act, ACT_PROTOTYPE) )
victim->pIndexData->mvr = value2;
return;
}
value2 allows me to mset it higher than 2billion, the code is
value2 = is_number( arg3 ) ? atof( arg3 ) : -1;
And then in db.c
sscanf( ln, "%d %d %d %d %d %d %d %llu",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8 );
pMobIndex->race = x1;
pMobIndex->class = x2;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
pMobIndex->mvr = x8;
do you have mvr in your structure also set to unsigned long long, as well as value2? Also, make sure that x8 is also an unsigned long long
In my first post, I said "I've put it in mob_index_data and char_data (in mud.h)" And value2 works fine, I've already tested it on players.
unsigned long long mvr;
what about x8?
Hmm, that could be why. How/where would I add the x8?
should be at the begining of the load_mobiles, the line:
int x1, x2, x3, x4, x5, x6, x7, x8;
should become
int x1, x2, x3, x4, x5, x6, x7;
unsigned long long x8;
If x8 is used anywhere else, you might need to make a seperate vaiable for this, something like
int x1, x2, x3, x4, x5, x6, x7, x8;
unsigned long long x9;
and change the line to read
sscanf( ln, "%d %d %d %d %d %d %d %llu",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x9 );
int x1, x2, x3, x4, x5, x6, x7, x8;
should become
int x1, x2, x3, x4, x5, x6, x7;
unsigned long long x8;
If x8 is used anywhere else, you might need to make a seperate vaiable for this, something like
int x1, x2, x3, x4, x5, x6, x7, x8;
unsigned long long x9;
and change the line to read
sscanf( ln, "%d %d %d %d %d %d %d %llu",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x9 );
What about this line?
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d %llu",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x9 );
I'm not sure I understand what your asking. All that line does is reset the values back to zero so that if something is not read in properly, it will set the x's with 0 instead of what they were previously declared as. If you don't use x9 before that, it will be set to 0 automatically. If you want to be safe, add x9 to that list.
So far, its still not working. I'll explain exactly what happens. I sign on the mud, copyover/reboot, mset the variable to 5, savearea, stat the mob, its still at 5, then copyover/reboot, loadarea, then stat the mob again. Its back to 0. Whats not working? Loading it, saving it, or we don't know?
Well, you can eliminate a few things by checking your area file to see if the value of 5 is where its supposed to be. If not, then its not writing to the file. I assume that you have the prototype flag on, so just check the appropriate line. If it is in the file, then the problem might be that it is being loaded into the mob index data, but not the mobs it self, you need to check create_mobile to move the data from the mob index into the inividual instances of the mob.
Argh, I don't see the variable. I set the value to 10, savearea, and open the area file. Then I close it, set it to 20, savearea, and open the area file again. Nothing changed, and I never did see the variable. I'll keep trying.
ok, to recap, the mob is set to prototype, and you mset its mvr to 10. Then you savearea. Then, you open the file with a text editor, go down to the mob you were editing, and the line is reading, what? 0? nothing at all? -1?
Nothing at all, I think. Right now I'm having a little different trouble.
This is new to me. I reverted the old change back to normal and I still get the error. Something wrong with my host?
gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG act_comm.c
In file included from /usr/include/bits/types.h:31,
from /usr/include/sys/types.h:31,
from act_comm.c:19:
/usr/lib/gcc-lib/i386-redhat-linux/3.2/include/stddef.h:201: syntax error before "typedef"
This is new to me. I reverted the old change back to normal and I still get the error. Something wrong with my host?
Fixed that problem, whoops. Now, I set the mob variable to 7, savearea, and check the mob. I'm not really sure whats what, but I don't see a 7.
So its not even saving to it?
1140851715 0 0 S
1 0 0 0d0+0 0d0+0
10 0
101 101 5
#1302
shopkeeper~
A shopkeeper~
A shopkeeper stand here, selling things
So its not even saving to it?
What you just posted is half of one mob and the other half of another. Each mob section starts at the #vnum. Make sure you're looking at the right mob. It would likely be the last number on the line.
Just a suggestion: mset the value to something totally unique, like (123454321) then do a search for that in the area file.
Just a suggestion: mset the value to something totally unique, like (123454321) then do a search for that in the area file.
Ugh, sorry about that. I've been sick the last few days, and I can't think straight, lol. Ok, I set it to 987 and savearea, searched in the area file, found nothing.
At least were getting somewhere. -_-
#1302
shopkeeper~
A shopkeeper~
A shopkeeper stand here, selling things
~
~
1140850691 0 0 S
1 0 0 0d0+0 0d0+0
0 0
101 101 1
At least were getting somewhere. -_-
Ok, so do you know which line it is supposed to be printing out? I beleive that the one you are using is for a "complex" mob, which is defined, at least in mine, as:
Which, as you notice, does not include your mvr variable. So, you might need to add it to this list to define it as a complex mob, like such:
If it is not considered "complex", as in none of the above variables are set, then it will not write it out.
Looking at your last post, it is simple mob, as it has the "S" here:
Of it were a complex mob, it would have been a C, I beleive. That is why it is not being written out. So add your variable to the list on that ifcheck, and it should then write it out.Hope that helps.
Greven
if ( pMobIndex->perm_str != 13 || pMobIndex->perm_int != 13
|| pMobIndex->perm_wis != 13 || pMobIndex->perm_dex != 13
|| pMobIndex->perm_con != 13 || pMobIndex->perm_cha != 13
|| pMobIndex->perm_lck != 13
|| pMobIndex->hitroll != 0 || pMobIndex->damroll != 0
|| pMobIndex->race != 0
|| pMobIndex->attacks != 0 || pMobIndex->defenses != 0
|| pMobIndex->height != 0 || pMobIndex->weight != 0
|| pMobIndex->speaks != 0 || pMobIndex->speaking != 0
|| pMobIndex->xflags != 0 || pMobIndex->numattacks != 0
|| pMobIndex->vip_flags !=0)
complexmob = TRUE;
else
complexmob = FALSE;
Which, as you notice, does not include your mvr variable. So, you might need to add it to this list to define it as a complex mob, like such:
if ( pMobIndex->perm_str != 13 || pMobIndex->perm_int != 13
|| pMobIndex->perm_wis != 13 || pMobIndex->perm_dex != 13
|| pMobIndex->perm_con != 13 || pMobIndex->perm_cha != 13
|| pMobIndex->perm_lck != 13
|| pMobIndex->hitroll != 0 || pMobIndex->damroll != 0
|| pMobIndex->race != 0
|| pMobIndex->attacks != 0 || pMobIndex->defenses != 0
|| pMobIndex->height != 0 || pMobIndex->weight != 0
|| pMobIndex->speaks != 0 || pMobIndex->speaking != 0
|| pMobIndex->xflags != 0 || pMobIndex->numattacks != 0
|| pMobIndex->vip_flags !=0
|| pMobIndex->mvr != 0)
complexmob = TRUE;
else
complexmob = FALSE;
If it is not considered "complex", as in none of the above variables are set, then it will not write it out.
Looking at your last post, it is simple mob, as it has the "S" here:
#1302
shopkeeper~
A shopkeeper~
A shopkeeper stand here, selling things
~
~
1140850691 0 0 S
1 0 0 0d0+0 0d0+0
0 0
101 101 1
Of it were a complex mob, it would have been a C, I beleive. That is why it is not being written out. So add your variable to the list on that ifcheck, and it should then write it out.Hope that helps.
Greven
Ah, that worked.
Thanks so much for everyone who helped!
One thing, old mobs now have that variable as "8,243,966,800,626,345,332". Why is this?
Thanks so much for everyone who helped!
One thing, old mobs now have that variable as "8,243,966,800,626,345,332". Why is this?
Glad to help. What likely happened was that it was trying to write out to the file, and the variable was null, so it created a random number it pulled from memory. Or, when it was trying to load the mobs without that number, same thing, read in from some random part of memory. Easiest thing to do is make it initialize the variable when it first creates the mob, in create_mobile I think, initialize it as 0, and then later on if the index is not zero, it would set it to whatever the appropriate value is.
Greven
Greven
Well, in create_mobile, I already have it set in there as
So you want me to change it to..
mob->numattacks = pMobIndex->numattacks;
mob->mvr = pMobIndex->mvr;
mob->speaks = pMobIndex->speaks;
So you want me to change it to..
mob->mvr = 0;
No, sorry, not create_mobile, my bad, load_mobiles. Should have a section something like this:
change it to such:, in the appropriate place, I think its:
Just the part for non-complex mobs. If that doesn't work, it means that the value was written into the files, and if so, that something else entirely.
if ( letter == 'C' || letter == 'Z' ) /* Realms complex mob -Thoric */
{
pMobIndex->perm_str = fread_number( fp );
pMobIndex->perm_int = fread_number( fp );
pMobIndex->perm_wis = fread_number( fp );
pMobIndex->perm_dex = fread_number( fp );
pMobIndex->perm_con = fread_number( fp );
pMobIndex->perm_cha = fread_number( fp );
pMobIndex->perm_lck = fread_number( fp );
pMobIndex->saving_poison_death = fread_number( fp );
pMobIndex->saving_wand = fread_number( fp );
pMobIndex->saving_para_petri = fread_number( fp );
pMobIndex->saving_breath = fread_number( fp );
pMobIndex->saving_spell_staff = fread_number( fp );
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=0;
sscanf( ln, "%d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7 );
pMobIndex->race = x1;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
if ( !pMobIndex->speaks )
pMobIndex->speaks = race_table[pMobIndex->race].language | LANG_BASIC;
if ( !pMobIndex->speaking )
pMobIndex->speaking = race_table[pMobIndex->race].language;
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8 );
pMobIndex->hitroll = x1;
pMobIndex->damroll = x2;
pMobIndex->xflags = x3;
pMobIndex->resistant = x4;
pMobIndex->immune = x5;
pMobIndex->susceptible = x6;
pMobIndex->attacks = x7;
pMobIndex->defenses = x8;
}
else
{
pMobIndex->perm_str = 10;
pMobIndex->perm_dex = 10;
pMobIndex->perm_int = 10;
pMobIndex->perm_wis = 10;
pMobIndex->perm_cha = 10;
pMobIndex->perm_con = 10;
pMobIndex->perm_lck = 10;
pMobIndex->race = 0;
pMobIndex->xflags = 0;
pMobIndex->resistant = 0;
pMobIndex->immune = 0;
pMobIndex->susceptible = 0;
pMobIndex->numattacks = 0;
pMobIndex->attacks = 0;
pMobIndex->defenses = 0;
}
change it to such:, in the appropriate place, I think its:
if ( letter == 'C' || letter == 'Z' ) /* Realms complex mob -Thoric */
{
pMobIndex->perm_str = fread_number( fp );
pMobIndex->perm_int = fread_number( fp );
pMobIndex->perm_wis = fread_number( fp );
pMobIndex->perm_dex = fread_number( fp );
pMobIndex->perm_con = fread_number( fp );
pMobIndex->perm_cha = fread_number( fp );
pMobIndex->perm_lck = fread_number( fp );
pMobIndex->saving_poison_death = fread_number( fp );
pMobIndex->saving_wand = fread_number( fp );
pMobIndex->saving_para_petri = fread_number( fp );
pMobIndex->saving_breath = fread_number( fp );
pMobIndex->saving_spell_staff = fread_number( fp );
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=0;
sscanf( ln, "%d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7 );
pMobIndex->race = x1;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
if ( !pMobIndex->speaks )
pMobIndex->speaks = race_table[pMobIndex->race].language | LANG_BASIC;
if ( !pMobIndex->speaking )
pMobIndex->speaking = race_table[pMobIndex->race].language;
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=x8=0;
sscanf( ln, "%d %d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8 );
pMobIndex->hitroll = x1;
pMobIndex->damroll = x2;
pMobIndex->xflags = x3;
pMobIndex->resistant = x4;
pMobIndex->immune = x5;
pMobIndex->susceptible = x6;
pMobIndex->attacks = x7;
pMobIndex->defenses = x8;
}
else
{
pMobIndex->perm_str = 10;
pMobIndex->perm_dex = 10;
pMobIndex->perm_int = 10;
pMobIndex->perm_wis = 10;
pMobIndex->perm_cha = 10;
pMobIndex->perm_con = 10;
pMobIndex->perm_lck = 10;
pMobIndex->race = 0;
pMobIndex->xflags = 0;
pMobIndex->resistant = 0;
pMobIndex->immune = 0;
pMobIndex->susceptible = 0;
pMobIndex->numattacks = 0;
pMobIndex->mvr = 0;
pMobIndex->attacks = 0;
pMobIndex->defenses = 0;
}
Just the part for non-complex mobs. If that doesn't work, it means that the value was written into the files, and if so, that something else entirely.
Well, uh, it looks like this right now
Looks a bit different than yours. I wanted 5 to be default when the mob is created.
}
else
{
pMobIndex->perm_str = 13;
pMobIndex->perm_dex = 13;
pMobIndex->perm_int = 13;
pMobIndex->perm_wis = 13;
pMobIndex->perm_cha = 13;
pMobIndex->perm_con = 13;
pMobIndex->perm_lck = 13;
pMobIndex->race = 0;
pMobIndex->class = 3;
pMobIndex->xflags = 0;
pMobIndex->resistant = 0;
pMobIndex->immune = 0;
pMobIndex->susceptible = 0;
pMobIndex->numattacks = 0;
pMobIndex->mvr = 5;
#ifdef XBI
xCLEAR_BITS(pMobIndex->attacks);
xCLEAR_BITS(pMobIndex->defenses);
#else
pMobIndex->attacks = 0;
pMobIndex->defenses = 0;
Looks a bit different than yours. I wanted 5 to be default when the mob is created.
thats for simple mobs, correct? So, either its loading that 8 trillion number when it should be setting it to 5, but I doubt thats its, so whats probably happening is that its setting the 8 trillion number for complex mobs when it has nothing to read in, so you could set it like such:
thus, initializing it to 5, and then it will change it if it is supposed to.
if ( letter == 'C' || letter == 'Z' ) /* Realms complex mob -Thoric */
{
pMobIndex->mvr = 5;
pMobIndex->perm_str = fread_number( fp );
pMobIndex->perm_int = fread_number( fp );
pMobIndex->perm_wis = fread_number( fp );
pMobIndex->perm_dex = fread_number( fp );
pMobIndex->perm_con = fread_number( fp );
pMobIndex->perm_cha = fread_number( fp );
pMobIndex->perm_lck = fread_number( fp );
pMobIndex->saving_poison_death = fread_number( fp );
pMobIndex->saving_wand = fread_number( fp );
pMobIndex->saving_para_petri = fread_number( fp );
pMobIndex->saving_breath = fread_number( fp );
pMobIndex->saving_spell_staff = fread_number( fp );
ln = fread_line( fp );
x1=x2=x3=x4=x5=x6=x7=0;
sscanf( ln, "%d %d %d %d %d %d %d",
&x1, &x2, &x3, &x4, &x5, &x6, &x7 );
pMobIndex->race = x1;
pMobIndex->height = x3;
pMobIndex->weight = x4;
pMobIndex->speaks = x5;
pMobIndex->speaking = x6;
pMobIndex->numattacks = x7;
thus, initializing it to 5, and then it will change it if it is supposed to.
Well, that didn't change anything, still a large variable. Oh well, its not a problem, I was just wondering why. All I have to do is change the mobs variable to something lower.