Impulse?
-
Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 pm
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.
Re: Impulse?
inpulses are unreliable. issue two of them at once and it'll forget the older one. enjoy.
Re: Impulse?
only one impulse can be sent by the client per frame.
-
Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 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();}
Code: Select all
alias +walking_right "impulse 18; +moveright"Knives out. Catch the mouse. Squash his head. Put him in your mouth.
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
-
Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 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.
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Impulse?
Here goes some small code snippets from a mod I am working.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.?
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;
Code: Select all
runspeed = cvar ("sv_maxspeed");
walkspeed = runspeed * cvar ("cl_movespeedkey");
Check if the player is on air (jumping or falling) or over some solid surface:
Code: Select all
if (!self.flags & FL_ONGROUND)Code: Select all
if (self.movement_y < -10)Code: Select all
if (self.movement_y > 10)Code: Select all
if (self.movement_x > 0) {// walking or running}Code: Select all
if (self.movement_x > walkspeed) {// running}Code: Select all
if (self.movement_x < 0) {// backwards}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)
-
Blackstar1000
- Posts: 52
- Joined: Mon Sep 13, 2010 5:16 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.