Dual wielding/multiple attacks wrong

Posted by Zeno on Tue 01 Aug 2006 10:03 PM — 10 posts, 22,097 views.

USA #0
This is stock FUSS with 4 attacks (dual wield):
Quote:
Your slash nicks Test Goblin.
Your pierce cuts Test Goblin!
Your slash misses Test Goblin.
Your pierce nicks Test Goblin.
Your slash cuts Test Goblin!


This is my MUD with 5 attacks (dual wield):
Quote:
Your slash scratches A Fire Cat. You do 1215 points of damage.
You injure A Fire Cat! You do 559479 points of damage.
You scratch A Fire Cat. You do 1180 points of damage.
You graze A Fire Cat. You do 139624 points of damage.
You scratch A Fire Cat. You do 1236 points of damage.


The damage verbs are missing (slash etc). Maybe from the 2nd weapon. That isn't right. Anyone know where to start looking for this? I did install Samson's Weapon Proficiency Patch, I have a feeling that might be it. Might have installed it wrong, or something wasn't compatible.
USA #1
This kind of stuff is handled in dam_msg, I think. One of the parameters is the type of damage being done, which for weapons should be the weapon type. You would want to find all cases where dam_msg is called and make sure the values are sane.
USA #2
Yeah I've been looking over some of the main fight functions, but don't see anything wrong. Something must be called wrong or the sort. I'll have to look into it some more.
USA #3
Basically you'll have to follow the call tree of calls to dam_msg, and make sure that every time that is called (or its parent functions) the damage type being sent in is the right one.

It's possible that you're passing in the weapon proficiency skill instead of the weapon's damage type. That's how the skill model tends to work; the skill number itself is used as the damage type.
USA #4
One thing you could try would be to run this through the debugger, setting a breakpoint in dam_msg and looking at it when it happens, instead of trudging through the code, constructing it all in your head. Might be easier. :)
USA #5
Pretty sure it's not new_dam_message at all. Although while looking it over, I noticed something odd.

This is the header:
void new_dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, OBJ_DATA *obj )

Below the function we find this:
#ifndef dam_message
void dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
    new_dam_message(ch, victim, dam, dt);
}
#endif


In the damage function, we find this:
        dam_message(ch, victim, dam, dt);


How is dam_message calling new_dam_message with one short of the argument? It's missing the obj arg. That shouldn't compile.
USA #6
C is somewhat forgiving of that kind of thing even though you're not supposed to do it. It's also a rather strange check, because defining a function won't cause #ifdef function to be true.

But I wasn't talking about new_dam_message but rather how it gets called. Obviously somewhere you're not passing in the right damage type, which is why it reverts to the standard damage messages instead of using the weapon damage messages.
USA #7
Yeah I know. Forgot to mention, dt is being passed as the wrong value. Since damage calls it, that may be the problem function.

Even more odd is that I posted the only call to the dam_message functions. Yet there are ifchecks in them for the obj (being passed in) while it will never be passed in.

[EDIT] Uh oh, it's not damage. It's called into damage wrong too.
Amended on Wed 02 Aug 2006 12:53 AM by Zeno
USA #8
This is where the debugger starts being very useful. :-) If you don't use it you'll have to do a grep of some kind to find all places that call damage.

But, I would start with the stuff in violence_update, that actually takes care of the attacks. I think the function that launches the attacks is called multi_hit or something like that, and is called from violence_update.
USA #9
Got it. It was in multi_hit. It was fixed in a more recent version of FUSS. Early on in multi_hit, it had this:
   if ( !dt || dt == TYPE_UNDEFINED )
        dt = TYPE_HIT;

Which wasn't good for various reasons. Commented it out.

Now I can get dual elements working. :)
Quote:
Your a lumber axe's Lightning attack overwhelms A Fire Cat's Fire element!
Your hack barely scratches A Fire Cat. You do 1487 points of damage.
A Fire Cat's Fire element disrupts your A No-Dachi's Ice attack!
Your slash barely scratches A Fire Cat. You do 653 points of damage.
Your a lumber axe's Lightning attack overwhelms A Fire Cat's Fire element!
Your hack barely scratches A Fire Cat. You do 1440 points of damage.
A Fire Cat's Fire element disrupts your A No-Dachi's Ice attack!
Your slash barely scratches A Fire Cat. You do 585 points of damage.
Your a lumber axe's Lightning attack overwhelms A Fire Cat's Fire element!
Your hack barely scratches A Fire Cat. You do 1421 points of damage.

Whoops, need to fix those names.