How to? Trains

Discussion in 'Mapping Questions & Discussion' started by Naso, Jul 15, 2009.

  1. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Hey guys, I'm trying to get just a simple train to work on my map, one that goes in a straight line and respawns back were It started, with a trigger hurt to It will kill people.

    I'm having a lot of trouble with It, I have looked for a lot of information on how to do It but I just can't get It to work.

    Any info on how to this something like this working would be awesome, thanks.
     
  2. Ezekel

    Ezekel L11: Posh Member

    Messages:
    818
    Positive Ratings:
    244
    i'm writing this from memory, as i don't have hammer available at the mo to check it, and i'm too lazy to look up a tutorial on it, so some of this might not be exactly right.

    your train is a brush entity (i think track_train is the name, make sure it's "track" and not "tank").
    if you want to use a model (like a train engine like in cp_well), you create a prop_dynamic, set it's model to what you want, and parent it to your track_train brush.
    if you'r eusing a model with your train, you probably don't want the brush to be visible in game then, so set it's render mode to "don't render", and texture it as nodraw (don't use playerclip, or clip ... otherwise people and sentry guns will be able to shoot through the train)

    where it will go is determined by point entities called "path_track"
    so plop down' 2 path_tracks. give them names like "track1" "track2" or something. and set them up so that A: they point to the other one for the next path_track field and that B: they use "fixed orientation" for the direction the train should face.
    on "track1" set the flag "teleport to THIS path_track" to be checked.

    now on your track_train, set the 1st path_track to be "track1"

    if you want it to kill things, you create a brush and turn it into a trigger_hurt. i can't remember the damage type you need to use to make it display the train icon when people are killed by it.
    next make sure that the trigger hurt is in front of the train, and parent it to the train.
    now what you want to do is make sure that the trigger hurt hurts everything (except debris) - that's a flag that you check. this means it will kill sentrys/dispensers/teleporters that get in the way of the trains movement.
    next create a filter_name entity and set it value to = the name you gave to any train props you parented to your train, and make the trigger hurt use this filter. this stops the trigger hurt from trying to apply damage to the train models.


    note: trains normally must be built facing to the right in the top down view. however as your's is moving in a straight line, you can build it to face the direction you want it to go in, and set it's orientation type to "fixed orientation" (it's a flag i believe).

    note2: parenting means that something will stay the same distance and orientation from what you parent it too. so you still have to make sure that parented things are positioned in the right place relative to the track_train, otherwise, they'll move in a straightline like you want, but won't be in the position that you want.


    hope that helps
     
    • Thanks Thanks x 2
  3. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Awesome, thanks for the explanation, I was looking through the well map for train stuff so this makes sense, but they go into a lot of logic stuff and it got confusing.

    I'll report on how I did later, thanks again.
     
  4. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Awesome everything seems to be working good!

    Now I have to figure out how to make it start going at random times not just constantly running.

    The only problem is that the trigger hurt only works when the player gets pushed into a wall for some reason?

    Any ideas?

    Here Is the vmf If you want too look at It, If there's any mistakes or something.

    https://files.getdropbox.com/u/1334246/train.vmf
     
    Last edited: Jul 16, 2009
  5. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    So, any ideas why the hurt trigger dosent kill the player on contact?
     
  6. maxtraxv2

    maxtraxv2 L3: Member

    Messages:
    103
    Positive Ratings:
    3
    works fine for me, but you can get stuck inside of the model witch then you wont die

    but thats becuase its so fast
     
  7. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    Is its parent the func_tracktrain?
    Does it start disabled (should not)
    Does it have an associated name filter, which filters OUT that which your train is called?
    How much damage is it set to?
    Is the damage type FREEZE?
    Is the damage model normal?
    Is the Zero Damage Force set to NO?

    Does the trigger_hurt actually cover the train so players hit the trigger before the model?
     
  8. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    It's parented to the train, Prop_dynamic.
    Start disabled is set to, No
    Yes it does ( Name: train_filter, Filter Name: train model ( Prop_dynamic name. )
    The damage is set too 2000
    Yes the damage type is freeze.
    Yes the damage mode is set to normal.
    Yes the Zero Damage Force is set to no.

    Yeah It covers all of the front part of the train model.

    Changed the parent and tested it out, and tried lowering the speed, and still nothing, I can walk in front of the train and glide off with out taking any damage.
     
    Last edited: Jul 22, 2009
  9. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    try

    filter_activator_name

    name: train filter
    filter mode: disallow entities that match the criteria
    filter name: train*

    func_tracktrain
    name: train1
    damage on crush: 1000
    maxspeed(if it makes a difference): 1024

    prop_dynamic
    name: train1_model



    I think just making sure both the model and trigger are parented to the func_tracktrain should do it, but we'll see.
     
  10. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Sigh thanks for the help, I have changed everything to what you have specified but the player can still slide right off the train while hes getting pushed by it. Ill try some random things with the brush positions to see if it will work.
     
  11. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    If all else fails, copypaste the one from Well :p

    Just make sure you set the start velocity to something, and go into the outputs and delete them all.
    Don't forget to copypaste the filter!


    You may need to do Alt+P to fix the hammerID problem (to get rid of it)
     
    • Thanks Thanks x 1
  12. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Yeah I was looking at the train from well, It's very complicated. It has so many logic stuff that ties to other stuff, It's too advanced for me.

    Thanks for trying :)

    If i ever do get it to work or anyone elce have any ideas, ill post here again. !
     
  13. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    Oh I am silly.. I forgot about the flags for the trigger_hurt.
    (I always forget about the flags)

    Flags ticked: clients, physics objects, everything (not including physics debris), physis debris



    (The copypasting would remove all ties to the logics, just copy the trigger, func_tracktrain and model and it's good to go.. just need to change the path track and the initial speed.

    The logics on the train are for telling it to start and stop. The track has ones for when the train passes to tell the gates to open and the sound to go choooo choooo and the warning lights and sounds to come on)
     
    Last edited: Jul 22, 2009
  14. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Yeah I already had all the flags set.
     
  15. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    Okay I just downloaded your map and your filter is set to ALLOW. It should be DISALLOW. I changed it, ran it and it kills you. (But not it's not moving. whut.)

    SUCCESS. Yeah I just fixed that parenting you had wrong in that map and it works fine now.
     
    Last edited: Jul 22, 2009
  16. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    Yeah that was the older one, before you told me to change it.

    I just re downloaded it and tried changing it, still doesn't kill you on contact only kills you when you reach the end of the level and get crushed.
     
  17. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    What :c

    All I changed was the parents, the flags (you pretty much had everything ticked rather than the 4 things) and switched a few names around for my own sake.
     
  18. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    Are you saving it before compiling it each time?
     
  19. alecom

    alecom L8: Fancy Shmancy Member

    Messages:
    516
    Positive Ratings:
    120
    Here's your map
     
  20. Naso

    Naso L2: Junior Member

    Messages:
    84
    Positive Ratings:
    9
    So I figured out why the trigger hurt was not killing you on contact, it was the flags, the "Only" flags were confusing the game i guess, next time i wont select almost everything lol, thanks alecom.

    But now, what would i need to look up to learn how to make the train stop and go at random intervals, not continuously running?