Moving objects

Having only started making maps yesterday, you can call me a noob if you like. And as a noob, I have a slightly stupid question to ask. I have not found any guides or instructions on how to make moving objects. I found one that tells me how to make an object raise up when you touch it, but it’s not what I need.

I need to learn how to make objects move on a timer. For instance, I have a block I wish to make move 96 units left, wait 15 seconds, then 96 units right, wait 15 seconds, and repeat.

If someone is willing to help me out, or even link me to some tutorials or instructions, I would be very appreciative.

You could use a func_movelinear and a logic_auto, and do this:

Set the func_movelinear move distance to 96 units, also set where to it should move.
Make an output for the logic_auto “OnMapSpawn -> MoveLinear -> Open”.
Now for the func_movelinear, “OnFullyOpen -> !self -> Stop”, “OnFullyOpen -> !self -> Close -> Delay = 15s”. Copy those 2 outputs but replace Open with Close and so forth.

EDIT: Nevermind, I figured it out.

Well fuck it. i spent a good 40 minutes procrastinating my homework to type this while texting 4 people and chatting with one on steam. And dammit I’m gonna post it. I don’t even care what ratings i get now.

You could also use two "path_track"s and a “func_tracktrain”. Make a path_track entity, and name it pt_1. Then select it, hold shift, then click it and drag to the next point you want the object to travel to. there should be an orange line connecting the two path_track entities. Hammer will auto-name and connect them. If you want it to continue going back and forth, open the properties on the last one and set next path_track to the name of the first one (pt_1). The next step depends on exactly what you want to travel the path; if you just want a single brush to travel it, go to method 1. If you want a model or anything else to travel along the path, go to method 2.

METHOD 1 Make the brush however you want it, and center it exactly on the first path_track, so that the little center mark "X"s are overlapping. Then, select the brush, press ctrl+t, and select “func_tracktrain” from the entity selection box in the top-left. Give it the name “train”. Set the “First Stop Target” to “pt_1”. Check off the flags: “Fixed Orientation”, “No User Control” and “No Pitch (X rot)”. Now, if you want it to start automatically, make a “logic_auto” entity with the output:
[lua]My output named: OnMapStart
target entities named: train
Via this output: Start forward[/lua]

Or, if you want to make it happen when a button is pressed, use this output on the button:
[lua]My output named: On button pressed
target entities named: train
Via this output: Start forward[/lua]

If you want it to start when a trigger is, well, triggered, use this output on the trigger:
[lua]My output named: On button pressed
target entities named: train
Via this output: Start forward[/lua]

METHOD 2 Make a small cube with the nodraw texture on all three sides and center it exactly on the first path_track, so that the little center mark "X"s are overlapping. Then, select the brush, press ctrl+t, and select “func_tracktrain” from the entity selection box in the top-left. Give it the name “train_parent”. Set the “First Stop Target” to “pt_1”. Check off the flags: “Fixed Orientation”, “No User Control” and “No Pitch (X rot)”. Now, if you want it to start automatically, make a “logic_auto” entity with the output:
[lua]My output named: OnMapStart
target entities named: train_parent
Via this output: Start forward[/lua]

Or, if you want to make it happen when a button is pressed, use this output on the button:
[lua]My output named: On button pressed
target entities named: train_parent
Via this output: Start forward[/lua]

If you want it to start when a trigger is, well, triggered, use this output on the trigger:
[lua]My output named: On button pressed
target entities named: train_parent
Via this output: Start forward[/lua]

Then, create the prop_dynamic or whatever you want to move along the path (HAS to have the “Parent” option in properties) and center it in the same place as the func_tracktrain block and first path track and set its “Parent” to “Train_parent”. Then if you set the outputs up right it should work.

IMPORTANT
There MAY be a small problem when the train returns to the first path_track, as I recall on the simple lift tutorial over at Half Wit that this method may cause the lift to return 8 units above or below the first path_track, but I’m not sure how true that is because I don’t think it happens to me. If it does happen and you can’t think of a solution I can give you a work around.

Expansion
The only reason I posted such a lengthy response even though wootmonster posted a solution that will work is because this method can be expanded upon to be much more useful in the future; with a little thought this can be used to make anything move in any path you want and loop; func_movelinear’s are much more restricted. I hope this helps, and yes I do have plenty of time for this when procrastinating homework. :slight_smile:

Well I certainly will try the expanded idea just so I can become acquainted with more stuff, but for now, the func_movelinear is exactly what I need.

Thanks anyways.

Yeah I know. But that’s what I spent my time doing and I just had to post it. >_>

Similar question: How do I make a rotating object? I don’t think this question merits a new thread.

What I’m looking for is how to make an object turn 90 degrees, wait X seconds, turn 90 degrees, wait X seconds, repeat, repeat, etc.

Use a Func_rotating. Honestly though, you should check the Mega thread at the top for questions like this. the link for the VDC isn’t in my history any more and I found that page by using links starting at the Mega Thread. Google probably could have given you this article as well. And for the future, he are some really good sites for general help with Hammer:

Interlopers
Half Wit
VDC - This is where I found the page on the func_rotating. It has a whole lot of crap on pretty much everything relating to mapping for source, but no really good tutorials.