Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   need help with a broken function (http://www.topmudsites.com/forums/showthread.php?t=5504)

UnKnOwN 04-27-2009 04:40 PM

need help with a broken function
 
i spent many hours trying to get this to work but i cant get it to work for some reason.
It is for a godwars dystopia mud. I'm trying to get the samurai's swordtech fury attack to deal a certain amount of damage per hit, but no matter what i do, it still does the same damage.

in class_samurai.c
heres a snipplet of the swordtech fury code
and in fight.c, i defined the damage modifier
as you can see i tried to set the damage to be anywhere from 2500-5000 per hit, but even if i put 9999 or w/e, it still only does like 1k damage or less. i also tried adding the damage modifier right after the fury code, but it doesnt do anything.

Newworlds 04-27-2009 06:39 PM

Re: need help with a broken function
 
I'm doubting many can help you with this jumble of code (many imbedded functions significant only to God Wars), but there is the creator of God Wars on here and his name is Kavir. You might try Pming him for some help.




My best guess is that you have a structured damage range that isn't modifiable OR this snippet:
if (dt == gsn_sfury && IS_CLASS(ch, CLASS_HIGHLANDER))
dam = number_range(2500,5000);
is false, thereby reverting to the structured damage range. Try debugging to ensure that your dam variable is used (a good trick is to remove the qualifier).

Mabus 04-27-2009 08:07 PM

Re: need help with a broken function
 
You can also try over at .

Baram 04-28-2009 08:02 PM

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.


All times are GMT -4. The time now is 09:26 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022