Acceleration

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Re: Acceleration

Post by Soviet » August 9th, 2008, 5:09 pm

but the problem I have there, is if they land before speed is back to 1, they're running around faster than normal, which I don't want to happen. Is there any way to revert it to 1 upon standing on a brush?
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Acceleration

Post by Drofder2004 » August 10th, 2008, 12:44 am

Code: Select all

while(i > 1 && player !(isOnGround()))
{
   player SetMoveSpeedScale(i);
   i=-0.1;
   wait 0.1;
}

player SetMoveSpeedScale(1);
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Re: Acceleration

Post by Soviet » August 10th, 2008, 3:05 am

sounds good, when I get to a testing point i'll try it out.
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Re: Acceleration

Post by Soviet » August 12th, 2008, 11:13 pm

I got it working for what I'm doing (with a lot of help from nm).

Code: Select all

accelerate_1() 
{ 
trigger = getent("svt_accelerate_1","targetname");  
while(1)
{
trigger waittill ("trigger",player);
i=12;
while(i > 1 && player isOnGround())
{
   player SetMoveSpeedScale(i);
   wait(.01);
}
player SetMoveSpeedScale(1);
wait(2);
}
}
Basically, there is a ramp. When the person gets on it for a second, they are on the ground, so they go 12 times normal speed for .01, then switch back to 1, however they naturally decelerate back to 1. It works great.
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Acceleration

Post by Drofder2004 » August 12th, 2008, 11:44 pm

The only problem I see, is the fact there is no such thing as "0.01" seconds.
A normal server runs at 20 frames per second, 1 second = 0.05 seconds per frame.

So, the shortest amount of script time is 0.05

But the engine automatically adjusts ;)
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests