View Single Post
Old 04-28-2009, 08:02 PM   #4
Baram
Member
 
Baram's Avatar
 
Join Date: Jan 2006
Location: Seoul
Home MUD: Tears of Polaris
Posts: 218
Baram is on a distinguished road
Re: need help with a broken function

As Newworlds said, it's going to be hard for most people to help you with but I'll take a stab at some things you can try.

Before I do, a couple notes...

1. I hope formatting (IE indentation) was just lost in the posting...

2. I'd recommend changing whatever that hard coded 33177 is into a marco or something else, generally bad practice to hard code numbers like that as it's meaning can be forgotten (where if it's a marco that's clearly named you'll always remember what it is) and if it ever changes it's MUCH easier to change a marco than go through all your code. I'm almost always a fan of finding another way of doing that, I'm assuming that's the vnum for some weapon or item, such as making it a flag/property on an item. Reason for that is if the item ever changes/no longer exists and that vnum gets reused you'll have some very strange and hard to track down bugs. Same deal with your races, a marco would be better than directly putting the numbers in, or better yet (though would require a rewrite of everything) a race database.

3. In your fight.c snippit you check "IS_CLASS(ch, CLASS_HIGHLANDER)" and then under it (inside that if block) you check "IS_CLASS(ch, CLASS_HIGHLANDER)" again, unless you cut out some code, why check it twice in a row?

Now for the code itself:

Ok, I lied... there just isn't enough code in there to really debug it, there's plenty of places the damage could get modified. I'd suggest spitting out some debug lines before this line:

if (dt == gsn_sfury && IS_CLASS(ch, CLASS_HIGHLANDER))

To verify what dt is, and then after:

dam = number_range(2500,5000);

To see what dam is, then continue spitting out dam for the rest of that routine up and to actually dealing the damage. Doing that you should get an idea of where it's changing, or if it's even getting set correctly at the start.

Good luck, wish I could have been more helpful.
Baram is offline   Reply With Quote