Jump to content
Sign in to follow this  

OnTrack Script for placing trains on rails

Recommended Posts

Since i started to learn sqf i have made bunch of more or less useful scripts.

Some out of need for script, some to see if i can and some just because.

Used them in my own missions but thought to post some here. Somebody might find use for them too.

OnTrack.sqf Script places train objects on rails.

One of the scripts i have made basically for no reason.

I have allways thought placing trains manually was PIA, not difficult at all but annoying.

Reason enough.

Basically it just places locomotive on the rails and uses attachTo with pre defined offsets to slap wagons on it.

Should work on any island/map that uses BIS rails.

I have used this on Chernarus and Podagorsk. Works great.

// ==================================================================
// HOW TO:
// Place locomotive on map.
// Zoom in on the rails you want the train on and use the object ID 
// number.
// Start the script from init field of the locomotive.
// [this,[i]ObjectID[/i]] execVM "OnTrack.sqf"
// If train is pointing wrong way use third parameter. (true/false)
// Default is false.
// [this,[i]ObjectID[/i],true] execVM "OnTrack.sqf"
// Place any train wagons you like within 50 meter radius of the
// locomotive. Closest will be first after locomotive etc...
// ==================================================================
// Known issues, "issues" and some other things:
// - Train is allways placed in straight line and horizontally level.
//   Placing train on curved rails or up/down slope is not going
//   to look good.
// - Due to the method used to get the rail height there is 5 second
//   delay before train is moved to the rails.
// - Placing more than one train. (for example on railyard)
//   Place them further than 50m apart in editor so they won't
//   mix up.
// - Train objects can be named. It won't affect the script.
// - Just wagons and no locomotive.
//   Placement is based on locomotive so here is one way to do it.
//   Place locomotive and wagons you want. Once train is on tracks
//   delete locomotive. Trigger with seven second delay works fine.
// - Locomotives can be used as wagons too.
// ===================================================================


This script was made with vanilla Arma2.

Not tested with OA but it should work just the same.

Multiplayer behaviour is uknown as my knownledge about MP requirements is nonexistent.

Oh...and no it does not make trains move, sorry.:p

Edited by Coyota
Fixed download link

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this