Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 04-27-2009, 05:40 PM   #1
UnKnOwN
New Member
 
Join Date: Nov 2002
Posts: 3
UnKnOwN is on a distinguished road
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
Quote:
else if (!str_cmp(arg,"fury"))
{
if (ch->pcdata->powers[POWER_TICK] > 0)
{
send_to_char("You cannot use swordtech again yet.\n\r",ch);
return;
}
for (ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room )
if (ich != ch)
{
if (is_safe(ch,ich)) continue;

stc("#0You cite a passage from your gleaming weapon and your eyes glow with coloration.#n\n\r",ch);
act("#0$n cites a passage from thier gleaming weapon and their eyes glow with coloration.#n",ch,NULL,NULL, TO_ROOM);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 3) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 6) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 9) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 12) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 15) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 18) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 21) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 24) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 27) one_hit(ch,ich,gsn_sfury,1);
if (ch->race > 30) one_hit(ch,ich,gsn_sfury,1);
}
if ((obj = get_eq_char(ch, WEAR_BODY)) != NULL && obj->pIndexData->vnum == 33177)
{
WAIT_STATE(ch, 2);
}
else
{
WAIT_STATE(ch,11);
}
if (!IS_IMMORTAL(ch))
ch->pcdata->powers[POWER_TICK] = 6;
if ((obj = get_eq_char(ch, WEAR_MASTERY)) != NULL && obj->pIndexData->vnum == 33177)
ch->pcdata->powers[POWER_TICK] = 3;

return;
}
else
{
send_to_char("Which swordtech is that?\n\r",ch);
return;
}
}
and in fight.c, i defined the damage modifier
Quote:
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_HIGHLANDER))
{
if (dt == gsn_sfury && IS_CLASS(ch, CLASS_HIGHLANDER))
dam = number_range(2500,5000);

}
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.
UnKnOwN is offline   Reply With Quote
Old 04-27-2009, 07:39 PM   #2
Newworlds
Legend
 
Newworlds's Avatar
 
Join Date: Aug 2007
Name: NewWorlds
Home MUD: New Worlds
Posts: 1,384
Newworlds will become famous soon enoughNewworlds will become famous soon enough
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).
Newworlds is offline   Reply With Quote
Old 04-27-2009, 09:07 PM   #3
Mabus
Member
 
Mabus's Avatar
 
Join Date: Jan 2006
Posts: 213
Mabus is on a distinguished road
Re: need help with a broken function

You can also try over at MUDBytes.
Mabus is offline   Reply With Quote
Old 04-28-2009, 09: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
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 04:43 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014