[Feature Request]One melee hit *per enemy*

DavidC

Active member
I changed the sword sound effect and realized I could get in 3 hits per swing, including at the very end of the animation when it is resetting (so the sword is moving unrealisticly slow to do any damage).

I found the one hit toggle, but that also prevents hitting two enemies with the same attack.

Since I'm making a fantasy game (combat like skyrim/vermintide) Both melee options are unacceptable.

Thank you
 
That sounds good, I'll add it in my Adventure Kit TODO list. I will be working on improving the melee combat for that project. Any improvements specific to the character system will be available in a future update.
 

So, did some more testing with melee, and I've also tried reading over the code to see what's going on. If you watch the video, the only changes I've made to default demo settings are: Increased repeat hit count from 20 frames to 50 frames, decreased body damage from 30 to 5.

Having things locked to frame rate is kind of crud, because as you can see, having a really high frame rate lets you get in tons of hits. Delta time would be much better. Even if I capped frame rate at something like 120... it would penalize anyone not at that frame rate...

Another thing that is lacking is the ability to cut the "hit" use period short (less than the animation). Basically the "max" equivalent of "can hit delay." It's really weird to see "hits" happening as the character returns their fists to their sides or their sword to their scabbard.
 
Having things locked to frame rate is kind of crud, because as you can see, having a really high frame rate lets you get in tons of hits. Delta time would be much better. Even if I capped frame rate at something like 120... it would penalize anyone not at that frame rate...
In cases like this I recommend using FixedUpdate instead of Update. That way everything will run at the same rate.

Another thing that is lacking is the ability to cut the "hit" use period short (less than the animation). Basically the "max" equivalent of "can hit delay." It's really weird to see "hits" happening as the character returns their fists to their sides or their sword to their scabbard.
The hits will occur between Use and Use Complete. We can look at the punching animations but there shouldn't be any hits registered between those two markers. Is that what you are referring to?
 
In cases like this I recommend using FixedUpdate instead of Update. That way everything will run at the same rate.
I'm on FixedUpdate, no root motion.


The hits will occur between Use and Use Complete. We can look at the punching animations but there shouldn't be any hits registered between those two markers. Is that what you are referring to?

I've tried that. Go to the last 5 seconds for a very obvious "double hit." This is with .2 start and .3 finish. I had other recordings with double hits, but that one is by far the easiest to see (damage is set to 5).

 
Interesting, I will have to look into this in more detail when I start the melee weapon refactor/improvements
 
Thanks for sending the scene. It looks like the enemy was being hit after the complete event was sent but the ability hasn't stopped because of the Stop Use Delay. You can fix this by changing line 530 of MeleeWeapon from:

Code:
            if ((m_SingleHit && m_AttackHit) || m_SolidObjectHit) {
to:
Code:
            if ((m_SingleHit && m_AttackHit) || m_SolidObjectHit || !m_Attacking) {
 
Top