PHP: public function knockBack(Entity $attacker, float $damage, float $x, float $z, float $base = 0.4){ $f = sqrt($x * $x + $z * $z); if($f <= 0){ return; } $f = 1 / $f; $motion = new Vector3($this->motionX, $this->motionY, $this->motionZ); $motion->x /= 2; $motion->y /= 2; $motion->z /= 2; $motion->x += $x * $f * $base; $motion->y += $base; $motion->z += $z * $f * $base; if($motion->y > $base){ $motion->y = $base; } $this->setMotion($motion); } yes, yes, I checked the forum to see how this function is used but I simply dont understand it. I literally started making simple plugins 2 weeks ago. Could someone here explain it to me how I can use this to set the knockback of x and y when you pvp. $attacker instanceof entitydamage etc. Thanks this is what im trying to use.
This is my first time working with Vector3 and x y and z and its confusing you act like im saying “GIVE ME THE CODE FOR DOING THIS KNOCKBACK” Reas instead. “Can someone here explain it to me” Those are my words not “Give me code”
I was referring to your thread title. You call it "kb", which nobody can understand without clicking into the thread to know it actually refers to "knockback". Now stop talking about this. I never said you just ask for code.
I got that frok the src of pmmp. I want to know how I can use it to set a specific x and y knockback and what z is for? :/ pls help
You've shown no evidence of an attempt. This section of the forum is for helping developers with their code, not explaining how to code or use certain functions from the core. Maybe if you put in a little effort people would be more inclined to help you because giving you code to copy won't help anyone in the long run; providing feedback about why your code/attempt/approach won't work will.
You cant force someone to help you. Atleast try and see if you can think of way or concept of how the function could work make the code if it doesnt work, THEN come on the forums for help from the devs on how you can fix your original code.