Inside3D!
     

Walk speed

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
SkinnedAlive



Joined: 25 Feb 2005
Posts: 65

PostPosted: Wed Aug 02, 2006 3:39 pm    Post subject: Walk speed Reply with quote

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
View user's profile Send private message
shadowtails



Joined: 30 Jul 2006
Posts: 11

PostPosted: Wed Aug 02, 2006 5:05 pm    Post subject: Re: Walk speed Reply with quote

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
View user's profile Send private message Visit poster's website
SkinnedAlive



Joined: 25 Feb 2005
Posts: 65

PostPosted: Wed Aug 02, 2006 6:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
shadowtails



Joined: 30 Jul 2006
Posts: 11

PostPosted: Wed Aug 02, 2006 7:48 pm    Post subject: Reply with quote

yeah it set player how speed will he moves
Back to top
View user's profile Send private message Visit poster's website
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Wed Aug 02, 2006 7:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Wed Aug 02, 2006 7:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
SkinnedAlive



Joined: 25 Feb 2005
Posts: 65

PostPosted: Wed Aug 02, 2006 8:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
spamalam



Joined: 10 Jul 2006
Posts: 30

PostPosted: Tue Aug 08, 2006 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Tue Aug 08, 2006 8:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
spamalam



Joined: 10 Jul 2006
Posts: 30

PostPosted: Tue Aug 08, 2006 8:45 pm    Post subject: Reply with quote

Sajt wrote:
That's a terrible way.


elaborate please. Wink
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Tue Aug 08, 2006 10:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
spamalam



Joined: 10 Jul 2006
Posts: 30

PostPosted: Tue Aug 08, 2006 10:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Tue Aug 08, 2006 11:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
TimeServ



Joined: 08 Jun 2005
Posts: 15

PostPosted: Wed Aug 09, 2006 12:37 am    Post subject: Reply with quote

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
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Wed Aug 09, 2006 5:02 am    Post subject: Reply with quote

Right. I should've mentioned that.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group