Page 1 of 1

vehicle flypaths

Posted: Mon Apr 14, 2003 9:46 pm
by Butch
ok part of my script that I converted from an original game script looks like this:

//////////////////////////
//TRAIN/////////////////
//////////////////////////

start_train:

$engine loopsound armoredtrain_rolling
$engine thread movecar_path
end

//*********************************************
// Thread for moving train cars on path
//*********************************************
movecar_path:
// speed, acceleration, look_ahead
self flypath $train_path 325 160 300
self move
end

How do I set up the flypath so I can see where the train is going in mohradiant?

Posted: Tue Apr 15, 2003 9:39 am
by bdbodger
$train_path is a set of connected infospline_ path nodes the first one targetnamed train_path you put them in your map and connect them so you should be able to see where they go?

Posted: Wed Apr 16, 2003 12:53 pm
by Butch
ok, and what does the look_ahead value do?

Posted: Wed Apr 16, 2003 1:22 pm
by bdbodger
not quite sure maybe the vision of the entity as to whether there is a change in direction in the SDK docs there is this
hascompletelookahead


returns true if there are no corners to turn on the rest of the AI's current path
It may be something like that only for entitys

Posted: Wed Apr 16, 2003 2:42 pm
by Butch
so, if I selected look_ahead 0, would it point north?

Posted: Wed Apr 16, 2003 3:11 pm
by jv_map
I think lookahead specifies the distance from the vehicle to a 'look ahead' point. This point moves in front of the vehicle at the given distance and follows the specified path. Instead of following a path, the vehicle drives to this lookahead point. This way it's able to take corners smoothily.

Posted: Wed Apr 16, 2003 3:36 pm
by Butch
so what should I type in?

logical

Posted: Wed Apr 16, 2003 3:46 pm
by tltrude
That seems logical because, when you use a spline path for airplanes, the plane flys smoothly along the node paths. It starts turning in the direction of the next path before it even gets to the the next node. You can also set pitch and roll at the nodes and it will lookahead for those too. But, you only need yaw for a train unless it climbs mountains. Read the "bomber.scr" script for more info about spline paths for planes.

Posted: Wed Apr 16, 2003 3:49 pm
by Butch
so I set it to 0?

Posted: Wed Apr 16, 2003 3:53 pm
by jv_map
Butch wrote:so what should I type in?
If you don't have corners in your railroad track it really doesn't matter.

Otherwise try 256 for a start and just tweak the value until it looks ok.

Posted: Wed Apr 16, 2003 4:01 pm
by Butch
thanks :wink:

Heres how I got my train moving

Posted: Fri Apr 18, 2003 7:41 pm
by Desert Eagle
Here is how I got mine working, but no sound...:(

the_train:

wait 10
local.origin = $train.origin + (0 0 64)
local.soundent = spawn script_origin origin local.origin
local.soundent notsolid
local.soundent thread the_trainsound
$train show
$train solid //so players will be killed if they are hit by train
$train anim smoke_on

thread the_trainsound

thread hidetrain
$train time 5
$train moveto $trainend
$train move
$train time 6
$train waitmove

$train.corona = 0 //makes sure the light on train looks right
waitframe
waitframe

end
//had to hide train after finishing its run, or it shows up on opposite side of map
hidetrain:
wait 7
$train hide
$train notsolid
end

the_trainsound:
self time 6
self move
self show
dprintln "Playing train sound!"
self svflags "+broadcast"
// Use loopsound to have the sound travel with the object.
self loopsound armoredtrain_rolling
// delete it 7 seconds later so it doesn't loop...
wait 7

self delete

End

$train sound

Posted: Sat Apr 19, 2003 12:05 pm
by tltrude
The train itself can play the sound:

$train loopsound armoredtrain_rolling

to stop the sound:

$train loopsound armoredtrain_rolling wait

if you also want engine sounds then just make the engine a different targetname and "bind" it to the train.

$engine bind $train

By the way, "armoredtrain_rolling" does not normally work in multiplayer maps. You'll need an ubersound.scr script work around.

Posted: Sat Apr 19, 2003 12:57 pm
by mohaa_rox
this is better:

$train stopsound armoredtrain_rolling