I have done a search for this, but results were almost but not quite what I was after. Probably needed to spend more time. Lazy.
Anyway; player speed. I've messed with player speed before; slowing them down dependant on what weapon was being carried. However, I'm still unsure about a few things:
1) What's the most efficient way of adjusting player speed? stuffcmd(self,"cl_forwardspeed 400\n"); type thing, or is there a better way?
2) In the example in bold above, does that change the walking or running speed?
3) If walking speed, does the running speed stay the same or is it a percentage increase of the walking speed?
4) If it changes the running speed, how do you change the walking speed?
For some, probably only partially, helpful background, I'm basically wanting to slow the player walking speed down to something realistic (that scary pretence!) and slow the running speed down to a realistic (again!) and temporary increase of that.
As always, thanks for any and all support.
ajay
Player Speed
Re: Player Speed
.float maxspeed;
use it. it is your friend.
Edit: I'm informed that maxspeed is QW only.
for reference, correct values are in qu. It is not a scaler.
use it. it is your friend.
Edit: I'm informed that maxspeed is QW only.
for reference, correct values are in qu. It is not a scaler.
Last edited by Spike on Wed Oct 23, 2013 6:22 pm, edited 1 time in total.
Re: Player Speed
thew walk and run speed is the same its just lower values feel like your walking and higher speed is running.
I did this in my QBall mod, where the ball carrier would run 20% slower.
in playerprethink
you could use an impulse to toggle run or walk i suppose....
I did this in my QBall mod, where the ball carrier would run 20% slower.
in playerprethink
Code: Select all
if ((self.flags) & FL_ONGROUND)
{
self.velocity_x = (1 - ((0.9 * (3)) * frametime)) * (self.velocity_x);// slow down ball carrier
self.velocity_y = (1 - ((0.9 * (3)) * frametime)) * (self.velocity_y);// slow down ball carrier
}
Re: Player Speed
well, i get something like you said usin maxspeed value in player_prethink function, when you crouch
i defined "maxspeed" value default as 0.85
after you can call a function like this in "player_run" function
but when you are walking maybe you need to get more stamine in a few time
so in player_stand function
EDIT: be careful with the jump values and maxspeed function
Code: Select all
self.velocity_x = self.velocity_x * self.maxspeed;
self.velocity_y = self.velocity_y * self.maxspeed;
after you can call a function like this in "player_run" function
Code: Select all
if (vlen(self.velocity) >= 120) // adjust 120 value is the minor velocity when you are "runing"
{
if (self.maxspeed >= 0.85)
self.maxspeed = self.maxspeed - *a very little value here* ;
}
else
{
if (self.maxspeed < 0.85)
self.maxspeed = self.maxspeed + *a very little value here* ;
}
so in player_stand function
Code: Select all
if (self.maxspeed < 0.85)
self.maxspeed = self.maxspeed + *a very little value here but bigger than the first values * ;
EDIT: be careful with the jump values and maxspeed function
hi, I am nahuel, I love quake and qc.
Re: Player Speed
If using DP, include the supplied svplayerphysics.qc file, in it theres a wishspeed float already coded that works very well.
vlen (self.velocity) also has some uses...some examples of it are here on this site somewhere.
vlen (self.velocity) also has some uses...some examples of it are here on this site somewhere.
Re: Player Speed
Got another question related to player movememt, may have asked it before but wanna make sure.
There is really no way to set the rate at with the client executes pitch or yaw? [ with Darkplaces mostly ]
cl_yawspeed and cl_pitchspeed will work on the keyboard but not the mouse. If you are doing multiplayer
stuffing the mousespeed cvar is sucky. I have tried .avelocity and does not work. Is it possible using .angles
or v_angle ?
There is really no way to set the rate at with the client executes pitch or yaw? [ with Darkplaces mostly ]
cl_yawspeed and cl_pitchspeed will work on the keyboard but not the mouse. If you are doing multiplayer
stuffing the mousespeed cvar is sucky. I have tried .avelocity and does not work. Is it possible using .angles
or v_angle ?
Re: Player Speed
Client view angles are owned by the client not the server. This allows the client to look around without waiting for an echo off the server. Latency sucks. Trying to override it on the server will seriously fuck everything up.
m_pitch and m_yaw control the indivudal mouse axis speeds. Beware that invert mouse is implemented by inverting the sign of m_pitch, so be sure to preserve the sign. Or you can override the user's sensitivity. Either way whatever you do will suck. Yay.
m_pitch and m_yaw control the indivudal mouse axis speeds. Beware that invert mouse is implemented by inverting the sign of m_pitch, so be sure to preserve the sign. Or you can override the user's sensitivity. Either way whatever you do will suck. Yay.
-
- Posts: 96
- Joined: Thu Dec 15, 2011 1:00 pm
Re: Player Speed
one time i used cvar_set ("sv_maxspeed", "80"); in worldspawn function for player's speed
Sorry for my english