Description: The main idea behind this was to implement custom elevators and sliding doors in-game. Create multiple func_tracktrain systems; each on their own set of path_tracks. You can set the model, sound, animation, speed, height and orientation of each tracktrain as well as optionally attach one or multiple buttons resulting in the train toggling off and on when pressed. If you don't like the way a train is setup, you can edit it and restart it or optionally; delete it. If you don't want to lose a train you've spent time making, you can save it under an alias and later load it on the same map you saved it on, under the alias you saved it as. There are multiple uses for this, a few examples would be sliding doors and elevators attached to buttons or animated models on a path.
You can get my GrabEnt plugin for a method to move and rotate the track props (cans), buttons, train props or any grab-able entity.
---
Admin isn't required, but you can set the flags if wanted.
CS:GO button is set to fire extinguisher, I have no idea of any models for CS:GO other than a few shared with CS:S.
The max train limit per player is 5, each train can have a maximum of 15 path_tracks and 2 buttons.
All the max values can be changed in the variable declarations near the top of the .sp
Use Notes:
Settings can not be changed and buttons/tracks can not be added to a train while it is active. These must be done before sm_train_start WITH ONE EXCEPTION: sm_train_animation can change the animation of a train in motion by adding an additional argument of train# - sm_train_animation <train#> <animation>
If a button is not attached to a train, it will infinitely loop from the last track back to the first.
You need a minimum of two tracks placed and a model set in order to start a train, the rest of the settings are optional.
If your train model appears too low or too high from the tracks, you can set the height with sm_train_height.
You can only save a train that is started, and you can only load a train that was saved on the same map.
Commands:
Code:
sm_train_track
> *TWO REQUIRED TO START*
> Spawn a path_track prop for the current train you're working on.
> These are what the tracktrain entity will follow.
sm_train_button
> OPTIONAL
> Spawn a button for the current train you're working on.
> The train will toggle off/on when pressed, as well as move from one end to the other end of the track in forward/reverse.
_________________________________________________________________________________________________
sm_train_model <model path>
> *REQUIRED TO START*
> Set the model of the current train you're working on.
> You can set a model through the argument, example: "models/combine_helicopter.mdl"
> OR you can look at a prop and steal its model path by leaving the argument blank.
sm_train_sound <sound path>
> OPTIONAL - DEFAULT: NONE
> Set the sound of the current train you're working on.
> Choose a sound from path, example: "npc/attack_helicopter/aheli_rotor_loop1.wav"
> Disable sound with any one of these arguments: "none"or"off"or"0"
sm_train_animation <animation>
> OPTIONAL - DEFAULT: NONE
> Set the animation sequence of a train.
> Unlike other settings you can use this on a train in motion by adding an additional argument of train# - sm_train_animation <train#> <animation>
> Not all models have animations and you'll need to know the name of the animation, example: "cwalk_pistol"
> Disable animation with any one of these arguments: "none"or"off"or"0"
sm_train_speed <1-2000>
> OPTIONAL - DEFAULT: 80
> Set the travel speed of the current train you're working on.
sm_train_height <-1000 to 1000>
> OPTIONAL - DEFAULT: 0
> Set the height of which the current train you're working on will ride above/below the tracks.
sm_train_orientation <0-3>
> OPTIONAL - DEFAULT: 0
> Set the turn type of the current train you're working on, this will determine how or if the train turns.
> 0 - Never turn(elevators/doors)1 - Turn near the next path 2 - Linear Blend 3 - Ease in and out
_________________________________________________________________________________________________
sm_train_start
> *REQUIRED: Model set and 2+ Path_Tracks spawned*
> Start the current train you're working on.
sm_train_edit <train#1-5>
> Edit the track, buttons and settings of the selected train.
> You can select a train through argument via train#
> OR you can select a train by looking at one and leaving the argument blank.
> Train will need to be started again when finished editing.
sm_train_delete <train#1-5>
> Delete the tracktrain system of the selected train.
> You can select a train through argument via train#
> OR you can select a train by looking at one and leaving the argument blank.
> Deletes everything associated with the selected train, this is permanent unless saved.
_________________________________________________________________________________________________
sm_train_save <train#1-5> <alias>
> The command takes two arguments: First the index of the train being saved and second, the alias(savename).
> Save the selected train to a file under an alias of your choice and load it later.
> If the save already exists, it will be overwritten
> The train you are saving must be active(started).
sm_train_load <alias>
> Load a train from an alias that you have saved.
> You must be on the same map that you saved the train on.
sm_train_saves
> Print a list of aliases of any saves you have on the current map.
Installation:
**FROM THE ZIP FILE** 1. Open the zip file and go into the sourcemod folder 2. Put the tracktrains folder in your servers sourcemod folder: GAME/addons/sourcemod/ 3. Put the TrackTrains.smx in the plugins folder: GAME/addons/sourcemod/plugins/ 4. Put the TrackTrains.sp in the scripting folder: GAME/addons/sourcemod/scripting/
----
**WITHOUT THE ZIP FILE** 1. Create a directory tree tracktrains/saves in your servers sourcemod folder: GAME/addons/sourcemod/tracktrains/saves 2. Steps 3 and 4 from above
----
NOTE: The tracktrains/saves directory tree is only required if you plan on using the save/load commands
Todo:
Spoiler
I may not be doing anything else to this unless a bug crawls out or someone has a cool suggestion
Code could use more optimization and cleaning though
CHANGELOG:
Spoiler
V1.0 (Sept 18, 2019)
Initial Release
V1.5 (Sept 19, 2019)
sm_train_button - attach buttons to toggle trains
Fixed a few bugs
V1.7 (Oct 4, 2019)
Made settings train-specific, so settings are reloaded when editing a train
Train model can now be stolen by looking at prop while leaving sm_train_model argument blank
*Fixed an issue that caused server crash*
V2.0 (Oct 5, 2019)
sm_train_save and sm_train_load
Incorporated L4D2 models
Cleaned some code and optimized a few things
V2.1 (Oct 6, 2019)
Fixed the last of the bugs I was aware of
Removed the <morecolors> dependency
V2.5 (Oct 9, 2019)
sm_train_animation - train play animation sequence
sm_train_height - train height above/below tracks
sm_train_saves - print list of aliases on current map
Now you can Delete or Edit the train you're looking at by leaving the corresponding commands argument blank
More cleaning and optimizations
New video of V2.5
Last edited by Stugger; 10-17-2019 at 23:14.
Reason: Changed post around a little
I'm really not sure, I have never actually played l4d or know how similar the engine is to hl2dm/css, but if the game shares the same 3 models being used then I can't see why it would not work! But if you find out otherwise please let me know.
I Just tested to see if they worked and got this
~~~
] models/props_interiors/vendingmachinesoda01a.mdl
Unknown command: models/props_interiors/vendingmachinesoda01a.mdl
] models/props_junk/popcan01a.mdl
Unknown command: models/props_junk/popcan01a.mdl
] models/props_combine/combinebutton.mdl
Unknown command: models/props_combine/combinebutton.mdl
~~~
so im taking this as no they dont