Forum

changing a players movement and speed with a function.

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

changing a players movement and speed with a function.

Postby ceriux » Mon Feb 02, 2009 6:42 am

basically i would like to player to either come to a extream crawl or to a complete stop, till a number meter is above a certain value.

the only thing i dont know how to do is actually change the players movement once self.stamina == 0 and return to normal after its raised above it.

(im using DP, and DPEXTENSIONS.QC with SV_USER.QC)
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby MauveBib » Mon Feb 02, 2009 6:59 am

Code: Select all
if (self.stamina == 0)
     if (vlen(self.velocity > 100))
        self.velocity = normalize(self.velocity) * 100;


EDIT

On second thoughts, you'll need to retain the velocity_z for falling etc.

Code: Select all
local float vz;

vz = self.velocity_z;

if (self.stamina == 0)
     if (vlen(self.velocity > 100))
        self.velocity = normalize(self.velocity) * 100;

self.velocity_z = vz;


Or an onground check. Play around, find what works best.
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest