accleration

Post your scripting questions / solutions here

Moderator: Moderators

kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Re: wait 1

Post by kai0ty »

tltrude wrote:Change "wait 1".
the lower the number the faster it will accelerate
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

Code: Select all

local.speed == local.speed * local.speed 
isnt doing anything
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

That's because 1 * 1 = 1 :idea:

To make the speed increase exponentially, use the following:
local.speed = 1.1 * local.speed

Where 1.1 is the 'factor of growth' :wink:
Image
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

lol i aint that simple, i changed the start speed to 5, n it still didnt work
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

fuhrer wrote:lol i aint that simple, i changed the start speed to 5, n it still didnt work
is it == or = u're using in that line?
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

==

after reading the scripting reference just now i get the feeling it should be = aint had time to try it yet
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

yes, i believe == is just for comparing two variables. At least I would use = ( and == just in if clauses), but then, I'm here mostly in search for As then for Qs :wink:
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

its only moving at a constant speed, altho it seems to multiply once as its definatley moving faster than 5 ups......so maybe its not looping for some reason just making the speed at local speed * 5 and keeping it at that.

Code: Select all

level waittill spawn

end

go:

	local.speed = 1
	
	$acc_trig waittill trigger
	$accelerator moveto $end
	$accelerator move
	while(local.speed < 2000)
	{ 
	local.speed = local.speed * 5
	$accelerator speed local.speed
	wait .02 
	} 

end
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

move

Post by tltrude »

I don't think you can change the speed without telling it to move again.

Code: Select all

level waittill spawn 

end 

go: 

   local.speed = 1 
    
   $acc_trig waittill trigger 
   $accelerator moveto $end 
   while(local.speed < 2000) 
   { 
   local.speed = local.speed * 5 
   $accelerator speed local.speed 
   $accelerator move 
   if ( $accelerator.origin == $end.origin )
       {
            break
       }
   wait .001 
   } 

end
It is going to be a rather sudden stop. Using "end" as a targetname is probably not a good idea.
Tom Trude,

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

Post by fuhrer »

not doing anything now
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post by fuhrer »

ok its working,

but for some reason when the speed gets to around 600, the acclerator stops and im gettin crushed, thers nothing in the way to stop it from reaching the waypoint,

after about it takes 1/4 of my health it carries on moving, then crushes me again when it reaches the waypoint.

any ideas?
go:

local.speed = 1

$acc_trig nottriggerable
local.rider = parm.other
local.rider glue $1
while(local.speed < 2000)
{
iprintln "speed " local.speed
local.speed = local.speed + 10
$accelerator speed local.speed
$accelerator moveto $end
$accelerator move
wait .08
}
goto go

end
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

waypoints

Post by tltrude »

The "end" waypoint may be to low and the cab slowly sinks down as it gets closer to it. Info_waypoints should always be in the exact center of the object and object detination.

Ps: I tested it and found there are limits to the speed you can move the player. At a top speed of 553 all was well, but at 1024 the player blocked movement and was slowly crushed to death. You might get around that by making the player "notsolid" while he is glued.

Here is the script I used for the test--my track was 7300 unit long.

Code: Select all

main:



	level waittill prespawn

	exec global/ambient.scr mohdm1

	$a_spot bind $accelerator
	$accelerator_trigger bind $accelerator
	level.aspeed = 2
	thread go_fast

	level waittill spawn

end


//------------------------------------------
// Accelerator
//------------------------------------------

go_fast:  

	$accelerator_trigger waittill trigger 
	local.rider = parm.other 
	local.rider glue $a_spot
	wait 1
	$accelerator loopsound lighthouse_run 
	while ( level.aspeed < 512 ) 
	{  
		level.aspeed = (1.1 * level.aspeed) 
		$accelerator speed level.aspeed
		iprintln "Speed = " (int(level.aspeed)) 
		$accelerator moveto $end_point 
		$accelerator move 
		wait .08 
	}
	while (vector_length ($accelerator.origin - $end_point.origin) > 16)
		
		wait .1  // loops every .1 seconds until not true
		
	iprintln "Final speed = " (int(level.aspeed))
	$accelerator stoploopsound
	local.rider unglue 
	//goto go_fast 

end
Tom Trude,

Image
Post Reply