View previous topic :: View next topic |
Author |
Message |
SkinnedAlive
Joined: 25 Feb 2005 Posts: 65
|
Posted: Wed Aug 02, 2006 3:39 pm Post subject: 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. |
|
Back to top |
|
 |
shadowtails
Joined: 30 Jul 2006 Posts: 11
|
Posted: Wed Aug 02, 2006 5:05 pm Post subject: 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 |
|
Back to top |
|
 |
SkinnedAlive
Joined: 25 Feb 2005 Posts: 65
|
Posted: Wed Aug 02, 2006 6:32 pm Post subject: |
|
|
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? |
|
Back to top |
|
 |
shadowtails
Joined: 30 Jul 2006 Posts: 11
|
Posted: Wed Aug 02, 2006 7:48 pm Post subject: |
|
|
yeah it set player how speed will he moves |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Wed Aug 02, 2006 7:54 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Wed Aug 02, 2006 7:56 pm Post subject: |
|
|
cl_movespeedkey sets the multiplier when holding down +speed (default 2.0). _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
SkinnedAlive
Joined: 25 Feb 2005 Posts: 65
|
Posted: Wed Aug 02, 2006 8:04 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
spamalam

Joined: 10 Jul 2006 Posts: 30
|
Posted: Tue Aug 08, 2006 5:46 pm Post subject: |
|
|
oh dear, well i did this for modifying the run speed when holding a particular weapon:
Code: |
// 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. |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Tue Aug 08, 2006 8:40 pm Post subject: |
|
|
That's a terrible way. I wonder if you set 'self.gravity = 2;' it would work though.. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
spamalam

Joined: 10 Jul 2006 Posts: 30
|
Posted: Tue Aug 08, 2006 8:45 pm Post subject: |
|
|
Sajt wrote: | That's a terrible way. |
elaborate please.  |
|
Back to top |
|
 |
Lardarse

Joined: 05 Nov 2005 Posts: 243 Location: Bristol, UK
|
Posted: Tue Aug 08, 2006 10:02 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
spamalam

Joined: 10 Jul 2006 Posts: 30
|
Posted: Tue Aug 08, 2006 10:14 pm Post subject: |
|
|
ah okay, that makes sense. When i was using it it didn't seem to have any adverse effects though, wonder why. |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Tue Aug 08, 2006 11:06 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
TimeServ
Joined: 08 Jun 2005 Posts: 15
|
Posted: Wed Aug 09, 2006 12:37 am Post subject: |
|
|
QW server physics is packet rate dependant for client entities, but in QW you have the maxspeed field which allows you to set the maximum running speed. |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Wed Aug 09, 2006 5:02 am Post subject: |
|
|
Right. I should've mentioned that. |
|
Back to top |
|
 |
|