Impulse?
Moderator: InsideQC Admins
9 posts
• Page 1 of 1
Impulse?
Does Quake have a problem reading many Impulses at once? As far as I can tell if two are called simultaneously it may reject one of them?
If, for example I did something of this sort
bind a +walking_left
alias +walking_left "impulse 19; +moveleft"
alias -walking_left "impulse 19; -moveleft"
bind d +walking_right
alias +walking_right "impulse 18; +moveright"
alias -walking_right "impulse 18; -moveright"
If I were to press A and D at the same time, as far as I can tell, the impulses come out all screwy. Any Idea?
If, for example I did something of this sort
bind a +walking_left
alias +walking_left "impulse 19; +moveleft"
alias -walking_left "impulse 19; -moveleft"
bind d +walking_right
alias +walking_right "impulse 18; +moveright"
alias -walking_right "impulse 18; -moveright"
If I were to press A and D at the same time, as far as I can tell, the impulses come out all screwy. Any Idea?
Knives out. Catch the mouse. Squash his head. Put him in your mouth.
- Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
Re: Impulse?
inpulses are unreliable. issue two of them at once and it'll forget the older one. enjoy.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Impulse?
only one impulse can be sent by the client per frame.
- metlslime
- Posts: 316
- Joined: Tue Feb 05, 2008 11:03 pm
Re: Impulse?
This is terrible news. =(
Knives out. Catch the mouse. Squash his head. Put him in your mouth.
- Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
Re: Impulse?
Follow up Question. If I have a " void Chaseright_Toggle() ' in my client.qc That is activated by an impulse when I press "D" to move right.
How would I substitute using an impulse? How in QuakeC could I say...
"If the player is walking to the right, activate void Chaseright_Toggle() " ?
in weapons.qc
in autoexec.cfg
is the exact stuff I need to replace.
How would I substitute using an impulse? How in QuakeC could I say...
"If the player is walking to the right, activate void Chaseright_Toggle() " ?
in weapons.qc
- Code: Select all
if (self.impulse == 18) {Chaseright_Toggle();}
in autoexec.cfg
- Code: Select all
alias +walking_right "impulse 18; +moveright"
is the exact stuff I need to replace.
Knives out. Catch the mouse. Squash his head. Put him in your mouth.
- Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
Re: Impulse?
maybe look at the player's "angles" and their "velocity" and figure out from that if they are moving towards their right or left
- metlslime
- Posts: 316
- Joined: Tue Feb 05, 2008 11:03 pm
Re: Impulse?
Stayed up all night getting the velocity check right. Success!
Any hints on where to start getting the directions for Forward, Back, Left, and Right.?
Any hints on where to start getting the directions for Forward, Back, Left, and Right.?
Knives out. Catch the mouse. Squash his head. Put him in your mouth.
- Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
Re: Impulse?
Blackstar1000 wrote:Stayed up all night getting the velocity check right. Success!
Any hints on where to start getting the directions for Forward, Back, Left, and Right.?
Here goes some small code snippets from a mod I am working.
There are more stuff here than you're asking, but I think this can be useful for others, too.
I am assuming Darkplaces or any engine supporting the .movement vector.
First, to check the speed values to "run" or "walk", declare 2 globals like:
- Code: Select all
float runspeed;
float walkspeed;
And then, place this at the top of PlayerPreThink:
- Code: Select all
runspeed = cvar ("sv_maxspeed");
walkspeed = runspeed * cvar ("cl_movespeedkey");
This way, no matter what the speed set for run or walk, the mod automatically "understands" it.
Check if the player is on air (jumping or falling) or over some solid surface:
- Code: Select all
if (!self.flags & FL_ONGROUND)
Check if the player is strafing left:
- Code: Select all
if (self.movement_y < -10)
Check if the player is strafing right:
- Code: Select all
if (self.movement_y > 10)
Check for forward movement:
- Code: Select all
if (self.movement_x > 0) {// walking or running}
- Code: Select all
if (self.movement_x > walkspeed) {// running}
Check for backward movement:
- Code: Select all
if (self.movement_x < 0) {// backwards}
To detect if the player is jumping or actually just walking over a slope (like stairs or a sidewalk). Took me a good amount of time to make it work right:
- Code: Select all
float absspeed = fabs(self.velocity_z);
if (absspeed >= walkspeed) {
// play a jump animation, for example
}
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: Impulse?
::EDIT:: Again ::: AGAIN::: ::AGAIN:::!! Saved me hours upon hours of work. These movement checks are unbelievable! My only problem was that I needed to add the .vector to the defs. ( I guess the darkplaces code comes with this initially )
But I figured it out immediately.
I was able to rewrite a huge chunk of my third person camera code more efficiently. It's amazing how perfect I was able to get it. The rest of these code blocks I am now looking into. Thanks again. I'm starting to feel more and more comfortable leaving my actionscript days behind me thanks to help like this.
But I figured it out immediately.
I was able to rewrite a huge chunk of my third person camera code more efficiently. It's amazing how perfect I was able to get it. The rest of these code blocks I am now looking into. Thanks again. I'm starting to feel more and more comfortable leaving my actionscript days behind me thanks to help like this.
Knives out. Catch the mouse. Squash his head. Put him in your mouth.
- Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest