detecting if player is runing
Moderator: InsideQC Admins
13 posts
• Page 1 of 1
detecting if player is runing
is there a way to know if the player is pressing the "+speed" button? i know is possible to know if the player is pressing button1 for example
thanks in advance
- Code: Select all
if (self.button1)
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
Re: detecting if player is runing
Without some extension like CSQC, probably not.
Maybe you can check the value from self.movement (which only works in some engines), and see if it matches the velocity for the running. This won't work if the running speed cvars have been modified.
Maybe you can check the value from self.movement (which only works in some engines), and see if it matches the velocity for the running. This won't work if the running speed cvars have been modified.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
Re: detecting if player is runing
i am using
- Code: Select all
vlen (self.velocity) > ...
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
Re: detecting if player is runing
I'm not really trying to troll... but who out there actually uses +speed (as opposed to always-run)?
does it actually make sense to try to detect it?
ssqc has no way to distinguish between +speed and merely setting cl_forwardspeed to 400 (aka: always-run) or so.
The evil way:
alias +speed +button5
alias -speed -button5
does it actually make sense to try to detect it?
ssqc has no way to distinguish between +speed and merely setting cl_forwardspeed to 400 (aka: always-run) or so.
The evil way:
alias +speed +button5
alias -speed -button5
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: detecting if player is runing
Check onground flag and check velocity > 200 (or so depending on what you expect) ?
Sure this doesn't check the button, but if the player is pressing the run button and forward while standing in a corner facing the corner, is he actually running?
[Does QuakeC get to know "wish velocity" [desired speed client sends to server?]
Sure this doesn't check the button, but if the player is pressing the run button and forward while standing in a corner facing the corner, is he actually running?
[Does QuakeC get to know "wish velocity" [desired speed client sends to server?]
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: detecting if player is runing
Baker wrote:Check onground flag and check velocity > 200 (or so depending on what you expect) ?
This actually can work pretty well. I already used this. In Darkplaces the relation between running/walking speed is controlled by a cvar (cl_movespeedkey, default = 2.0). In other engines this relation is fixed in 2.
Basically, check your effective speed (doing some nasty math with self.velocity or directly with .movement if available) against sv_maxspeed / factor; if lower or equals, it's walking.
As a side note cl_movespeedkey with values below 1.0 actually slow down the player. This can be handy for stalking mods (like in the shadows).
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: detecting if player is runing
"Does QuakeC get to know "wish velocity" [desired speed client sends to server?]"
.movement is exactly that.
not fantastically different from velocity, but doesn't get clipped by sv_maxspeed, has lower latency, and works even if they're stupid enough to be running into a wall.
.movement is exactly that.
not fantastically different from velocity, but doesn't get clipped by sv_maxspeed, has lower latency, and works even if they're stupid enough to be running into a wall.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: detecting if player is runing
player.qc uses this
you can just before the self.walkframe=0; test for how fast. Like Baker suggested >200 is running/+speed is on...
Spike I cant find .movement in vanilla qc...
- Code: Select all
if (self.velocity_x || self.velocity_y)
{
self.walkframe=0;
player_run();
return;
}
you can just before the self.walkframe=0; test for how fast. Like Baker suggested >200 is running/+speed is on...
Spike I cant find .movement in vanilla qc...
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: detecting if player is runing
r00k wrote:Spike I cant find .movement in vanilla qc...
IIRC not all engines support it, or it's like the .gravity field that is supported by Quake 1.08 and above, because it was added in hipnotic. Memory is failing a lot today (I need sleep)...
EDIT: also, vanilla QC just tests if the player is in movement, it doesn't check if running or just walking (since the animations are the same).
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: detecting if player is runing
ack note toself add .movement extention
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: detecting if player is runing
afaik p0x qcv1.06 addons have this feature in the footsteps, if you run the play faster...
-

drm_wayne - Posts: 232
- Joined: Sat Feb 11, 2012 5:47 pm
Re: detecting if player is runing
I believe the p0x method is dropping entities and comparing their vector lengths with the current player origin.
i should not be here
- leileilol
- Posts: 2783
- Joined: Fri Oct 15, 2004 3:23 am
13 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest