if(!saves_spell(waterball))
{
damage = number_range(100, 200) + mod_stat[STAT_INT];
if(spell_percent > 99)
dam *= 1.25;
act_damage(Yadayadayda);
}
else
{
damage = number_range(50, 100);
if(spell_percent > 99)
dam *= 1.25;
act_damage(Ydayadayda);
}
return;
int value = ((ch->hit/ch->max_hit)*100);
if(value < 75)
{
// do stuff
}
if (ch->hit < (ch->max_hit/4)*3)
{
// do stuff
}
int value = ((ch->hit/ch->max_hit)*100);
if(value < 75)
{
// do stuff
}
if (ch->hit < (ch->max_hit/4)*3)
{
// do stuff
}
int value = ((ch->hit*100)/ch->max_hit);
if (ch->hit < (ch->max_hit*3)/4)
Who knows. But I vanished, as if without a trace, from the MUD scene in very very early 2003. With only a marginal resurgence in 2004 to tweak some of my code.
Bearing in mind, all that's good and well, but not the point of this little anecdote.
So, I found my old codebase I'd been reworking from back then last week. I pulled it out, and…after installing compilers on my system again…
I had to go correct lots of errors…and even more errors…and then a few more…then I had to download zlib…
It was a hilariously arduous process, because I'm a stubborn person and run Win7 x64.
Finally, after all of that, I get a compile in MSVS10. I launch…game crashes…
So, more hunting to find why the game is having issues. It kept dying while trying to load my org.lst file setup (I wrote together some stuff for organizations in the game). And…I was baffled….for a very long time…until it occurred to me, to add a hard return under the terminating $ in the .lst file.
Suddenly! The game runs, and I'm like a little kid, enthralled that I was able to do something so…'monumental'? Nah, but it reminded me of both the joy and frustration I always received from doing mud coding and development.
With that, I was off, completing things from a todo.txt file that was almost as old as my daughter, churning out changes, rebooting, doing more, rebooting… Then I decided to add in Erwin's esteemed copyover, and off I went again.
Everything was going splendidly…until I noticed an oddity. Even at creation, level 1….every playerfile included the spell Acid Blast….and to boot….it was inextricably linked to the player's Hunger/Thirst/Full condition…..so it was degrading over time.
I started digging through every line of code, every piece related to adding skills to the player. I tried seeing if there was a link to player conditions…
I found none. Nowhere in the code are the two linked, in any fashion. I wracked my brain over this for a full day, growing more and more frustrated.
My friend, who is no coder, tries to talk to me about the issue. He's rambling on in what is his attempt to think/talk coding, when suddenly, something he says spurs me into action. He makes a comment about writing character data. I'd already been over fwrite_char, load_char_obj, and fread_char and found nothing there, but it was when he said "character data" I knew where I failed to look.
I dive into merc.h and here is what I find.
And down in the struct for pc_data
I stared, and immediately began laughing like a lunatic. This, this was the problem, the entire time. When writing out pc conditions to the playerfile, it was calling for MAX_COND, but the struct only allowed for 4, and it was rolling over into the next piece of the struct, grabbing sn[0] (and ignoring as the for loop starts with 0), and printing to file, the first spell on the list (1) which is acid blast, and assigning the value of the last condition to the spell.
I felt both relieved and stupid, as this problem was one that predated finding my code. It was a booboo I made back in 2003, and never found, until now.
Sorry for the long read, but you coders out there might find it slightly amusing.
Regards,
Verias
aka Keith W.