View Single Post
  #1  
Old 07-16-2014, 09:55 PM
Furniture
Hill Giant
 
Join Date: Aug 2012
Posts: 205
Default Implementing "melee push" with doknockback?

I am trying to code in the old school melee push from melee hits on my server but I am stuck.

In the attack code for npc attacks, i added this in:

Code:
if (!(other->IsRooted())) {

	other->DoKnockback(this,(MakeRandomFloat(0,.1)),0);
	}
This works as intended, but the downside is that when a player is fleeing and a mob is chasing him down, with each hit the player is moved a little closer to the enemy. If the player is not moving, the push works on the player as intended.

And I realize that DoKnockback() is a mob method but it has a IfClient() check in the beginning so I'm not sure if this would even be able to work on npcs until i attempt to remove the client restriction.

There has to be an easier way to do this. Can anyone point me in the right direction?
Reply With Quote