Problems witch crouching tutorial
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
Problems witch crouching tutorial
hello evyrybody i have problem witch DP crouch tutorial.When i crouch in decreesing wall wich is smaller then player and i release the courch button i stand through wall.How can i repair this bug?
This is the CHRIS crouch code:
//===================
//Chris
//Crouch for player '06
//===================
.float crouch, attemptcrouch;
float (entity targ) crouchcheck =
{
makevectors (self.v_angle);
tracebox (self.origin, VEC_HULL_MIN, VEC_HULL_MAX, self.origin + '0 0 16', FALSE, self);
/*
vector VEC_HULL_MIN = '-16 -16 -24';
vector VEC_HULL_MAX = '16 16 32';
*/
if (trace_fraction == 1) //hits nothing go ahead
return TRUE;
if (!trace_ent.takedamage) //hits world or nondamagable object
return FALSE;
return FALSE;
};
void() crouch_on =
{
if ((!self.crouch) && (!self.velocity_z)) //crouch down
{
setsize (self, '-16 -16 -8', '16 16 8');
self.crouch = 1;
self.view_ofs = '0 0 14';
self.attemptcrouch = 1;
return;
}
self.attemptcrouch = 0;
};
void() crouch_off =
{
if (self.crouch && (!self.velocity_z) && (crouchcheck(self))) //get up
{
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
self.crouch = 0;
self.origin_z = self.origin_z + 16;
self.view_ofs = '0 0 22';
self.attemptcrouch = 0;
return;
}
self.attemptcrouch = 1;
};
Many thanks for help
This is the CHRIS crouch code:
//===================
//Chris
//Crouch for player '06
//===================
.float crouch, attemptcrouch;
float (entity targ) crouchcheck =
{
makevectors (self.v_angle);
tracebox (self.origin, VEC_HULL_MIN, VEC_HULL_MAX, self.origin + '0 0 16', FALSE, self);
/*
vector VEC_HULL_MIN = '-16 -16 -24';
vector VEC_HULL_MAX = '16 16 32';
*/
if (trace_fraction == 1) //hits nothing go ahead
return TRUE;
if (!trace_ent.takedamage) //hits world or nondamagable object
return FALSE;
return FALSE;
};
void() crouch_on =
{
if ((!self.crouch) && (!self.velocity_z)) //crouch down
{
setsize (self, '-16 -16 -8', '16 16 8');
self.crouch = 1;
self.view_ofs = '0 0 14';
self.attemptcrouch = 1;
return;
}
self.attemptcrouch = 0;
};
void() crouch_off =
{
if (self.crouch && (!self.velocity_z) && (crouchcheck(self))) //get up
{
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
self.crouch = 0;
self.origin_z = self.origin_z + 16;
self.view_ofs = '0 0 22';
self.attemptcrouch = 0;
return;
}
self.attemptcrouch = 1;
};
Many thanks for help
- shadowtails
- Posts: 11
- Joined: Sun Jul 30, 2006 7:16 am
SkinnedAlive wrote:When I tested it I noticed that monsters also completely ignore you when you're crouched.
Because it changes the view_ofs to '0 0 0', which usually signals you've entered intermission. You could change that line to 0 0 1 and it would look pretty much the same, but monsters would no longer ignore you.
- FrikaC
- Site Admin
- Posts: 1026
- Joined: Fri Oct 08, 2004 11:19 pm
No it lowers it to 0 0 14 view_ofs.
Quick fix:
open fight.qc
go to: float() CheckAttack
find:
spot2 = targ.origin + targ.view_ofs;
replace with:
if (!targ.crouch)
spot2 = targ.origin + targ.view_ofs;
if (targ.crouch)
spot2 = targ.origin;
Also due to Hull issues in different versions of bsp's that darkplaces supports (example: hl1 / q1 maps) it can't change the hull size effectively and causes sometimes to 'walk thru walls'. I wish I could edit this tutorial a bit more, it was just a snippet of code I had laying around from the hunted 3 that I never used. Sorry for the confusion. Hopefully that work around at least solved the issue of monsters seeing you, and good luck on your mod endeavors.
Quick fix:
open fight.qc
go to: float() CheckAttack
find:
spot2 = targ.origin + targ.view_ofs;
replace with:
if (!targ.crouch)
spot2 = targ.origin + targ.view_ofs;
if (targ.crouch)
spot2 = targ.origin;
Also due to Hull issues in different versions of bsp's that darkplaces supports (example: hl1 / q1 maps) it can't change the hull size effectively and causes sometimes to 'walk thru walls'. I wish I could edit this tutorial a bit more, it was just a snippet of code I had laying around from the hunted 3 that I never used. Sorry for the confusion. Hopefully that work around at least solved the issue of monsters seeing you, and good luck on your mod endeavors.
- Chris
- Posts: 79
- Joined: Sat Aug 05, 2006 5:31 am
FrikaC wrote:Send me any edits you want to make, or submit an alternate version of the tutorial and I swap out the old one with a new one.
i want to make Quake2 style crouching with increasing wall(do not stay through wall,staz crouch).
- shadowtails
- Posts: 11
- Joined: Sun Jul 30, 2006 7:16 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest