Push from a stab

Support for MFPS 2.0 (for verified users)
Forum rules
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
Post Reply
User avatar
Leonid_RU
Contributor
Contributor
Posts: 57
Joined: Tue Sep 11, 2018 3:04 am

Hello!
Tell me how to implement a push when stabbed. That is, when I hit a bot or a player with a knife, so that it recoils.
MFPS 1.9
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi,

Sorry but I do not offer support for custom modifications,
I can only point you in the right direction.

In order to move a player you can apply the offset position to where the player will move to the 'moveDirection' vector in bl_FirstPersonController,
that Vector value is private so you will have to make a public property or a function inside the script, then you applied the "recoil" similar to this:

Code: Select all

void StabTest(Vector3 stabRecoil)
{
moveDirection += stabRecoil;
}
The code is not tested, it is just to give you an idea.

For the bots, is similar with the only difference that you will have to apply the offset position directly to the transform.position.

I hope this helps.
How to find your Invoice Number: Here
How to find your Order Number: Here
Post Reply