Tutorial #7: The Func_train entity W A V E L E N G T H
by HellBringer January 20, 1999
Foreword:
This tutorial assumes that you have both Half-Life and Worldcraft 2.0, and are fairly proficient in the use of Worldcraft, in that you have completed the previous tutorials in this series.

WARNING: This tutorial is not for the faint of heart! The map is fairly complex; so if you're not familiar with everything that's been covered in my previous tutorials, you may be a little overwhelmed. Remember to start small and build up in complexity; it will save you a lot of frustration in the end! If you have any questions or problems as a result of this thing, definitely email me and I'll try to help clear the confusion.

This article covers how to use:
- The Func_train entity
- The Path_corner entity

 

 Continued from Page 1...

   Now you might have noticed that the train seems solid to the player - it can push you around, and even hurt you; but when it comes to OTHER level geometry, the train isn't really "solid". Let me show you what I mean. Switch to entity mode, and set the grid spacing to 16 units. Then select the entity type "path_corner" in the object box. Place a path_corner entity at XY coordinates (-304, -32); and place the entity in the Z axis anywhere that is completely inside the room. Switch to selection mode and choose the path_corner. Then bring up the entity properties window. Set the "name" key to "stop4". The "Next stop target" key should be "stop1". Under the "wait" key, enter a value of "0". Lastly, set the "new train speed" to "50". Close the entity properties window. Choose the "stop3" path_corner. Bring up the Entity properties window, and change the "Next Stop Target" key from "stop1" to "stop4". Then close the properties window.

Here's a Screenshot showing the path_corners and func_train.

   Compile and run your map, and test this new setup. NOTE: See the train clearly going THROUGH the walls? Also, you may need to hit the button to set it in motion at the very beginning; after that you should only need to re-trigger it when it hits path_corner "stop3".

   There's a trick we can use for the times when we want the train to go back to the starting point; but we DON'T want it to be seen or to pass THROUGH things like that last test-run. Let me show you... Switch to selection mode. Select the "stop1" path_corner. Bring up its Entity Properties, and choose the "Flags" tab. Checkmark the "Teleport" flag. This will make the train go instantly TO THIS corner, from its previous stop target. Also, let's show you how to make the train able to pass through players and creatures: Check the "Not Solid" flag.

Here's a Screenshot showing the path_corners and func_train.

   Compile and run your map, and test the "teleport". NOTE: You may need to hit the button to set it in motion at the very beginning; after that you should only need to re-trigger it when it hits path_corner "stop3".

   There's one last thing I want to show you: the ability for a func_train to set off other events. Switch to entity mode, and set the grid spacing to 16 units. Then select the entity type "env_explosion" in the object box. Place an env_explosion entity at XY coordinates (-384, -32); and on the Z axis anywhere that is completely inside the room. Switch to selection mode and choose the env_explosion. Then bring up the entity properties window. Set the "name" key to "explode1". Under the "Flags", you'll want to select "Repeatable" (so it can go off more than once), and "No Damage" (so the player isn't accidentally killed while this test is done). Close the entity properties window. Select the path_corner "stop2". Bring up the entity properties. Under the key "Fire on Pass", type in "explode1". Close the entity properties window.

Here's a Screenshot showing the path_corners and env_explosion attributes.

   Compile and run your map, and test this new setup. NOTE: The explosion should happen every time the train passes "stop2". Also, you may need to hit the button to set it in motion at the very beginning; after that you should only need to re-trigger it when it hits path_corner "stop3".

   Sometimes we only want to trigger an effect once. We can adjust our "fire on pass" to do this. Select the path_corner "stop2". Bring up the entity properties. Under the Flags, select "Fire once". Close the entity properties window.

   Compile and run your map, and test this. NOTE: The explosion should happen ONLY on the first time the train passes "stop2", even though our env_explosion is still set up to happen multiple times (the path_corner only triggers it once). Also, you may need to hit the button to set it in motion at the very beginning; after that you should only need to re-trigger it when it hits path_corner "stop3".

   Well, that aboutwraps it up for the func_train entity. As you can see, there are lots of possibilities; and even some we didn't cover today (they will be in future tutorials). Overall its not TOO tough to set up; its just getting all of your path_corners to be positioned right and have the proper settings.

  As always, feel free to email me any comments, questions, or problems!

Half-Life, and the Half-Life logo are trademarks of Valve Software and Sierra Online, used with permission. All screenshots and drawings of Half-Life are (c) copyright Valve Software, 1998. All rights reserved. All original content (text and art) are (c) copyright Wavelength, 1998, and may not be reproduced without permission.