accleration

Post your scripting questions / solutions here

Moderator: Moderators

fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

accleration

Post by fuhrer »

is there a way to have a script object speed up gradually, like start it moving 1 units per second and have it accelerate to 2000

without doin

speed 1
speed 2 etc etc

dunno if that would work either but i dont want 2000 lines in the script :)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

try a do-while loop....

Code: Select all

threadname:

do
{
speed ++
iprintln "speed upped by one"
wait 5
}
while (level.speed < 10)

it would bring your speed up by one per 5 seconds, going until your speed is 10. assuming you started at 1.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

assuming i started at 1? do u mean if i set the speed at 1 in prespawn?
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

ok im a little confused by that
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

oops hit submit too soon..

Code: Select all

level.speed = 1


level waittill spawn

go:

	$accelerator moveto $end
	$accelerator move
	do
	{ 
	speed ++ 
	iprintln "speed upped by one" 
	wait .2 
	}
	while (level.speed < 2000) 


end
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

maybe take a look at the ring.pk3 at mohaa recycling bin. those rings accelerate
Combat Kirby
Lance Corporal
Posts: 18
Joined: Wed Mar 03, 2004 7:50 pm

Post by Combat Kirby »

What lizardkid means is that you would run a "while" loop until the perferred top speed for your script object has been reached like this:

$your_script_object speed 1
$your_script_object moveto $end_object
$your_script_object move

local.speed = 1

while(local.speed <2001)
{
local.speed ++
$your_script_object speed local.speed
iprintln "speed upped by one"
wait 5
}

See if that works.

regards,
kirby.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

yeah, sorry. i type kind of fast and don't always proofread. :oops:

i meant if your level.speed variable began at 1, the while would keep going until it got to ten.

sorry if i'm a bit confusing, i'm more accustomed to C++ than this scripting language. :wink:
yeah, thanx Kirby, i forgot that moveto command as well.
a mind is a terrible thing to lose.

oops. :shock:
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

wait

Post by tltrude »

With that "wait 5" it will take over 2 3/4 hours to reach 2000 units per second.
Tom Trude,

Image
Combat Kirby
Lance Corporal
Posts: 18
Joined: Wed Mar 03, 2004 7:50 pm

Post by Combat Kirby »

Your right!! Sorry Tom. Lets change that wait time to

wait .05

High Velocity speed increase per!
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

or this way

Code: Select all

$your_script_object speed 1 
$your_script_object moveto $end_object 
$your_script_object move 

local.speed = 1
local.accel = 1

while(local.speed <2001) 
{
local.accel++ 
local.speed = local.speed + local.accel 
$your_script_object speed local.speed 
wait 1 
} 
looks a bit different and takes about 60 loops
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

its not workin, is there sposed to be an = in this line?

Code: Select all

$your_script_object speed local.speed 
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

its workin now but its accelerating way to slowy if at all, can i make it increase exponentially?

or would it be easier to just put

speed 5
speed 10
speed 15
etc etc
kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Post by kai0ty »

instead of
local.speed ++
put
local.speed == local.speed * local.speed
that expontentially
or u can do
local.speed == local.speed + 5
to at 5 every time.
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

wait 1

Post by tltrude »

Change "wait 1".
Tom Trude,

Image
Post Reply