Please or Register to create posts and topics.

Making objects move on complex randomized routes

Since path_tracks can only reliably link to 2 other tracks at a time, I have been tearing my hair out trying to make a certain object visit every room in my map without using a single linear path, or multiple linear paths that originate from the same start point.

(I can upload the map vmf if it helps, minus the trashy spiderweb of path_tracks I tried.)

Here are some pics. the rooms are colorcoded, the walls are orange and the possible paths are cyan/blue.

map.png

I just want an object to be able to arbitrarily go along these paths as it pleases, without a specific order, pausing at each major room/endpoint.

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!

Does the object have to actually "move" into each room along those paths or is it okay for it to just "appear" in each room?

You could try a logic_case with the random selected input/output and a set of teleport landmarks. I haven't used much Portal2/Hammer in quite a while so I know those might not be accurate names of the entities. I'm sure you can figure out what I mean. Or try path_tracks with a logic_case with outputs that have both movetopathpoint and teleporttopathpoint. That should make it look random.

I'm not saying this idea will work, but it is an idea for you to look into maybe?

The object must move rather than teleport, for gameplay and aesthetic purposes.
I did try the movetopathnode output but it didnt really work because the origin path_track must be directly connected to the target path_track in a forwards connection, which isn't possible since path_tracks can only connect to one other path_track, plus one alternate branch path.

Actually I have an idea (this next part is my thoughts in real time so there may be confusion)

Maybe using a system of teleports and movetopathnode would work, but a little bit different way.

I could have the object just have an origin point that isn't too suspicious looking, maybe the black room (hallway type area) and have most of the paths lead back to it, then have the moving object teleport-switch paths to an identical point on that origin that leads to a new room of the map, and once the moving object has made a stop at those places, they would be idle there for however long I wanted.

Then, afterwards, I would build branching paths, which have origin points identical to those stop points in the rooms that the moving object will teleport to after the idle time is up, and have each path point is teleports to be randomized.

The paths could be from one room to the neighboring, without including ones that aren't nearby. For example, room light blue could lead to room light red and room puke brown. Maybe room black. But it could not lead to room purple, room white, room grey, etc.

/ideas

Ok that was a long post XD I'm going to try some more stuff out and report back.

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!

You could try to link path_tracks to any other path_track you want by changing the target.
Just fire

Code: Select all
OnFireUser1
myPathTrackToChange
Addoutput
target NewTargetName

Thanks, but I actually did get it working, in a slightly different manner to what you mentioned, Skotty, but thank you anyway. :D

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!

Just because I'm interested.. what solution did you use?

The easiest would be to use the alternate route and, in case of more than two branches, you just have to add one extra path track so in the sum you got 3 branches again.

I had each possible branching path be a different, unconnected path_track that leads to a dead end path.

That dead end is also the same location of multiple other origin path_tracks, which branch into paths to different rooms. When the train passes the dead end, it waits 3 seconds, and then tells a logic_case to pickrandomshuffle.

The logic_case then tells the train to teleporttopathnode to one of the new tracks in the same location of the dead end, and the train resumes along a random new path.

It may seem pretty complex but using visgroups for all the different tracks, it works pretty well and it isn't too confusing.

This also allows me to turn off the logic_case and instead force the train to visit a specific area, if needed.

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!