Walk speed
Moderator: InsideQC Admins
15 posts
• Page 1 of 1
Walk speed
Is there any way to set seperate walk and run speeds either by cvars or qc?
I've tried sv_maxspeed and cl_<whatever>speed but it leaves the walk speed at the same default value.
I've tried sv_maxspeed and cl_<whatever>speed but it leaves the walk speed at the same default value.
- SkinnedAlive
- Posts: 65
- Joined: Fri Feb 25, 2005 5:03 pm
Re: Walk speed
You can make it lake this:
void() W_WeaponFrame =
{
if (time < self.attack_finished)
return;
ImpulseCommands ();
if (self.weapon == IT_AXE) {
stuffcmd(self,"cl_backspeed 400\n");
stuffcmd(self,"cl_forwardspeed 400\n");
stuffcmd(self,"cl_sidespeed 400\n");
}
else if (self.weapon == IT_SHOTGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_SUPER_SHOTGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_NAILGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_SUPER_NAILGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_GRENADE_LAUNCHER) {
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
stuffcmd(self,"cl_backspeed 320\n");
}
else if (self.weapon == IT_ROCKET_LAUNCHER) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_LIGHTNING) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
// check for attack
if (self.button0)
{
SuperDamageSound ();
W_Attack ();
}
};
Change it to your speed
void() W_WeaponFrame =
{
if (time < self.attack_finished)
return;
ImpulseCommands ();
if (self.weapon == IT_AXE) {
stuffcmd(self,"cl_backspeed 400\n");
stuffcmd(self,"cl_forwardspeed 400\n");
stuffcmd(self,"cl_sidespeed 400\n");
}
else if (self.weapon == IT_SHOTGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_SUPER_SHOTGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_NAILGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_SUPER_NAILGUN) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_GRENADE_LAUNCHER) {
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
stuffcmd(self,"cl_backspeed 320\n");
}
else if (self.weapon == IT_ROCKET_LAUNCHER) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
else if (self.weapon == IT_LIGHTNING) {
stuffcmd(self,"cl_backspeed 320\n");
stuffcmd(self,"cl_forwardspeed 320\n");
stuffcmd(self,"cl_sidespeed 320\n");
}
// check for attack
if (self.button0)
{
SuperDamageSound ();
W_Attack ();
}
};
Change it to your speed
- shadowtails
- Posts: 11
- Joined: Sun Jul 30, 2006 7:16 am
I think I may have gotten confused as to what these cvars actually do...
Am I right in thinking that cl_forwardspeed, backspeed, etc set the walk speed of the player and sv_maxspeed sets the run?
Am I right in thinking that cl_forwardspeed, backspeed, etc set the walk speed of the player and sv_maxspeed sets the run?
- SkinnedAlive
- Posts: 65
- Joined: Fri Feb 25, 2005 5:03 pm
cl_*speed sets the individual rates of the various movement keys on the client's machine -- it's a client side cvar, so be aware all you need to do to 'cheat' with it is bring down the console and change the value.
sv_maxspeed sets the maximum player movement speed for everyone in the game, regarless of what the various cl_*speed keys are set to.
sv_maxspeed sets the maximum player movement speed for everyone in the game, regarless of what the various cl_*speed keys are set to.
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
Great, cheers guys.
Edit: It might be a good idea if somebody who knows what they're talking about adds this information to the wiki.
Edit: It might be a good idea if somebody who knows what they're talking about adds this information to the wiki.
- SkinnedAlive
- Posts: 65
- Joined: Fri Feb 25, 2005 5:03 pm
oh dear, well i did this for modifying the run speed when holding a particular weapon:
Is this a bad way of doing it? Are the cmds a better of doing it? With that all the forward/backward/side are modified to half and it seemed to work.
- Code: Select all
// v 0.0.2 - Slow down the player if they are on the ball
if (self.enemy.classname == "soccer_ball")
{
self.velocity = self.velocity * 0.5;
}
Is this a bad way of doing it? Are the cmds a better of doing it? With that all the forward/backward/side are modified to half and it seemed to work.
-

spamalam - Posts: 31
- Joined: Mon Jul 10, 2006 7:15 am
If I'm reading that correctly, it will either halve the player's speed every frame, making them slow down very fast, or only affect the current speed of the player, meaning that they will speed up very soon after.
Better would be coping self_velocity, removing the z component, and then checking if the vector length is above 160. If it is, then scale the vector down until it is 160 long. Then add back in the z component and put that back into self.velocity
Better would be coping self_velocity, removing the z component, and then checking if the vector length is above 160. If it is, then scale the vector down until it is 160 long. Then add back in the z component and put that back into self.velocity
-

Lardarse - Posts: 266
- Joined: Sat Nov 05, 2005 1:58 pm
- Location: Bristol, UK
If you do that every frame, it will be framerate dependant. As certain engines enforce certain server frame rates (DP does this even in listen multiplayer, QW does this) under those engines it will seem fine. Under normal quake engines, it will act odd and inconsistanty.
The code you should use, as was mentioned is something akin to:
local float len;
len = vlen(self.velocity);
if (len>160)
self.velocity = normalize(self.velocity)*160;
or such.
The code you should use, as was mentioned is something akin to:
local float len;
len = vlen(self.velocity);
if (len>160)
self.velocity = normalize(self.velocity)*160;
or such.
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest