Page 1 of 2
accleration
Posted: Fri Mar 26, 2004 6:15 pm
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

Posted: Fri Mar 26, 2004 7:44 pm
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.
Posted: Fri Mar 26, 2004 7:49 pm
by fuhrer
assuming i started at 1? do u mean if i set the speed at 1 in prespawn?
Posted: Fri Mar 26, 2004 7:51 pm
by fuhrer
ok im a little confused by that
Posted: Fri Mar 26, 2004 7:59 pm
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
Posted: Fri Mar 26, 2004 7:59 pm
by wacko
maybe take a look at the ring.pk3 at mohaa recycling bin. those rings accelerate
Posted: Fri Mar 26, 2004 8:00 pm
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.
Posted: Fri Mar 26, 2004 8:19 pm
by lizardkid
yeah, sorry. i type kind of fast and don't always proofread.
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.
yeah, thanx Kirby, i forgot that moveto command as well.
a mind is a terrible thing to lose.
oops.

wait
Posted: Fri Mar 26, 2004 8:37 pm
by tltrude
With that "wait 5" it will take over 2 3/4 hours to reach 2000 units per second.
Posted: Fri Mar 26, 2004 8:45 pm
by Combat Kirby
Your right!! Sorry Tom. Lets change that wait time to
wait .05
High Velocity speed increase per!
Posted: Fri Mar 26, 2004 10:00 pm
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
Posted: Sat Mar 27, 2004 12:42 am
by fuhrer
its not workin, is there sposed to be an = in this line?
Code: Select all
$your_script_object speed local.speed
Posted: Sat Mar 27, 2004 1:12 am
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
Posted: Sat Mar 27, 2004 1:29 am
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.
wait 1
Posted: Sat Mar 27, 2004 3:02 am
by tltrude
Change "wait 1".