Questions on the player controlller
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
Questions on the player controlller
I'm working on a few enhancements to the player controller and i wanted to ask you guys a few things:
1) Is it possible to make the player controller a little different, based on the level he's in? For example, i want to make an icy level, where the floor is a little slippery.
2) Double-jumping. I saw a few threads about it, but it seems a little hackish. Has this been done in a more elegant way? Also, how do i make the player double-jump any time during the jump, not just when the first jump apex is reached?
3) Dashing. How can i make the player run for a few seconds if he double-tapped the forward button?
1) Is it possible to make the player controller a little different, based on the level he's in? For example, i want to make an icy level, where the floor is a little slippery.
2) Double-jumping. I saw a few threads about it, but it seems a little hackish. Has this been done in a more elegant way? Also, how do i make the player double-jump any time during the jump, not just when the first jump apex is reached?
3) Dashing. How can i make the player run for a few seconds if he double-tapped the forward button?
- JasonX
- Posts: 411
- Joined: Tue Apr 21, 2009 2:08 pm
Re: Questions on the player controlller
JasonX wrote:I'm working on a few enhancements to the player controller and i wanted to ask you guys a few things:
1) Is it possible to make the player controller a little different, based on the level he's in? For example, i want to make an icy level, where the floor is a little slippery.
In QuakeC, find in the check for the map "E1M8" that changes the sv_gravity ...
world.qc
- Code: Select all
void() worldspawn =
{
lastspawn = world;
InitBodyQue ();
// custom map attributes
if (self.model == "maps/e1m8.bsp")
cvar_set ("sv_gravity", "100");
else
cvar_set ("sv_gravity", "800");
And set some funky movement cvars for your strange movement map.
2) Double-jumping. I saw a few threads about it, but it seems a little hackish. Has this been done in a more elegant way? Also, how do i make the player double-jump any time during the jump, not just when the first jump apex is reached?
Probably store the first jump time, and if say .5 seconds has elapsed and the player isn't on the ground, allow the jump to work. All a jump does as far as I know is give the player some up velocity and checking if FL_ONGROUND (or whatever it is called).
Meaning the player can only jump if on the ground.
I'm not Mr. QuakeC so I could be wrong about this, but I don't think I am since the QMatrix mod had wall jump and the player certainly isn't on the ground when he's not on the ground.
Here is where to look in client.qc
- Code: Select all
void() PlayerJump =
{
local vector start, end;
if (self.flags & FL_WATERJUMP)
return;
if (self.waterlevel >= 2)
{
if (self.watertype == CONTENT_WATER)
self.velocity_z = 100;
else if (self.watertype == CONTENT_SLIME)
self.velocity_z = 80;
else
self.velocity_z = 50;
// play swiming sound
if (self.swim_flag < time)
{
self.swim_flag = time + 1;
if (random() < 0.5)
sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
}
return;
}
if (!(self.flags & FL_ONGROUND))
return;
if ( !(self.flags & FL_JUMPRELEASED) )
return; // don't pogo stick
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
self.flags = self.flags - FL_ONGROUND; // don't stairwalk
self.button2 = 0;
// player jumping sound
sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
self.velocity_z = self.velocity_z + 270;
};
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: Questions on the player controlller
Corrected below!

Last edited by Nahuel on Mon Mar 28, 2011 3:34 pm, edited 1 time in total.
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: Questions on the player controlller
Nahuel wrote:JasonX wrote:2) Double-jumping. I saw a few threads about it, but it seems a little hackish. Has this been done in a more elegant way? Also, how do i make the player double-jump any time during the jump, not just when the first jump apex is reached?
very interesting question, I had never wondered something like that.
I created the following code and I hope I hope that you will like.
First in defs.qc put this line near to the end;
.float salto;
later change the code PlayerJump that is in client.qc with this new
void() PlayerJump =
{
local vector start, end;
if (self.flags & FL_WATERJUMP)
return;
if (self.waterlevel >= 2)
{
if (self.watertype == CONTENT_WATER)
self.velocity_z = 100;
else if (self.watertype == CONTENT_SLIME)
self.velocity_z = 80;
else
self.velocity_z = 50;
// play swiming sound
if (self.swim_flag < time)
{
self.swim_flag = time + 1;
if (random() < 0.5)
sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
}
return;
}
if (self.flags & FL_ONGROUND)
self.salto == 0;
if (self.salto == 0)
{
if ( !(self.flags & FL_JUMPRELEASED) )
return; // don't pogo stick
if ( !(self.flags & FL_ONGROUND) )
return; // don't pogo stick
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
self.flags = self.flags - FL_ONGROUND; // don't stairwalk
self.button2 = 0;
// player jumping sound
sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
if
(self.velocity_z >= 0);
self.velocity_z = self.velocity_z + 280;
self.salto = self.salto + 1;
}
if (self.salto == 1)
{
if ( !(self.flags & FL_JUMPRELEASED) )
return; // don't pogo stick
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
self.flags = self.flags - FL_ONGROUND; // don't stairwalk
if
(self.velocity_z >= 0);
self.velocity_z = self.velocity_z + 280;
if
(self.velocity_z < 0); // I believe the problem is here
self.velocity_z = 300 + (random() * 20);
self.button2 = 0;
// player jumping sound
sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
self.salto = 0;
}
};
this gave me an idea, a species of ladder-wall similar to those of megaman!!!!!!!!! I will try to make it
![]()
![]()
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: Questions on the player controlller
JasonX wrote:3) Dashing. How can i make the player run for a few seconds if he double-tapped the forward button?
The quick way is to piggyback an impulse into the +forward command, through an alias:
- Code: Select all
alias +forward_dash "+forward;impulse 69"
alias -forward_dash "-forward"
And then you can create a new .float in the QC code to track the last time this impulse was pressed, and execute the dash function if the last time this impulse has been pressed is too close to the current time it has been pressed.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
