Author Topic: Speed of a player(Solved) Fixing states  (Read 1242 times)

In that case you can just check the player's velocity. If they're not moving very much, make the bullet have less spread. Or: If the player is moving, add some movement to the bullets too.
that's what I'm basically doing, i'm just editing that one value

no, I meant directly use the player's velocity to multiply spread.

no, I meant directly use the player's velocity to multiply spread.
Oh.
Time to start experimenting then.

I believe the L4D2 Weapon Pack's sniper rifles used this method of movement-creates-spread, but it was more boolean.
But you could just create an equation that calculates their total velocity and uses it to create spread.
Random functions pulled from some other script i made:
Code: [Select]

function Player::getTotalVel(%this) //adds up the absolute values of player velocity on X, Y, Z axes and returns the number
{
%vel = %this.getVelocity();
%velx = mAbs(getWord(%vel, 0));
%vely = mAbs(getWord(%vel, 1));
%velz = mAbs(getWord(%vel, 2));

%totalVel = %velx + %vely + %velz;
say(%velx@"+"@%vely@"+"@%velz@"="@%totalVel);
return %totalVel;
}

function Player::getAvgVel(%this) //uses the above function to calculate the average of velocities on 3 axes
{
%totalVel = %this.getTotalVel();
%avgVel = %totalVel/3;

return %avgVel;
}

There's already a player.getvelocity() that returns one word, I think.

say(%velx@"+"@%vely@"+"@%velz@"="@%totalVel);
??

say(%velx@"+"@%vely@"+"@%velz@"="@%totalVel);
??

I'm guessing debugging purposes.

Never thought about that.Thanks, but how do I tell which one is when the player is walking?
runForce


say(%velx@"+"@%vely@"+"@%velz@"="@%totalVel);
??
I'm guessing debugging purposes.
Yeah, get rid of that line. I forgot that was still there.

Thanks guys, but I got a new problem.

Thanks guys, but I got a new problem.
Um, what exactly is the purpose of saying that

Thanks guys, but I got a new problem.
Well why havn't you told us the question.