Making a path_track choose a random path

Avatar
hemotem
21 Posts
Posted Apr 09, 2012
I do not know if this is even possible to do but what I am looking at doing is having a path_track choose a random Next Stop Target what I have is a logic auto and a logic case to choose the randomness but getting the track its self to switch between 1 2 3 or 4 is the issue.

Any help would be appreciated.

Hemotem

Advertisement
Registered users don’t see ads! Register now!
Avatar
Lpfreaky90
2,842 Posts
Posted Apr 09, 2012
Replied 14 minutes later
Erm; you use a func_track train?
Use a relay for every case and let it movetonode <<name of the point>> that should work. I can't test it at the moment though :sad:
Avatar
hemotem
21 Posts
Posted Apr 09, 2012
Replied 6 minutes later
the train travels from point 0 to point 1 but stops at point 1. I will try using a relay and see if that works thanks
Avatar
Lpfreaky90
2,842 Posts
Posted Apr 09, 2012
Replied 30 minutes later

hemotem wrote:
the train travels from point 0 to point 1 but stops at point 1. I will try using a relay and see if that works thanks

Train travels from A to Random(path_1-6).
Just make the random output -> trigger the case; let the case trigger a relay.
Let relay_1 MoveToPathNode path_1
Relay 2: Ontrigger, Train, MoveToPathNode, path_2
etc. that should do it :razz:

Avatar
hemotem
21 Posts
Posted Apr 09, 2012
Replied 2 hours later
It tries to work it just keeps going to track_5 and back to track_1 and ignoring track_2 track_3 and track_4. I do not know if it is the logic_case or the logic_timer that is not choosing a proper random case
Avatar
Lpfreaky90
2,842 Posts
Posted Apr 09, 2012
Replied 1 hour later
Add a logic_relay (relay1) that triggers the random case.
Let relay 1 trigger another relay (relay 2) with a delay of 5 seconds
Let relay 2 trigger relay 1 after a delay of 0.01 seconds; That's a cheaty way to do a timer and you can rule out if there's a problem with the timer :smile:
Avatar
hemotem
21 Posts
Posted Apr 09, 2012
Replied 1 hour later
Timer was not it so something is the case_logic I am about ready to ditch this idea but it has me frustrated enough to continue on this will make the third day of trying to get this to work I have dug through valves and this great site along with Google and YouTube tutorials on all the elements and still not quite right.

If anyone has an idea on how to do this... train_1 starts at track_1 and has a random choice to go to track_2 thru Track_4 and back to track_1 again then resetting and choosing a different random track to take and back. Rinse and repeat.

In advance I thank you for any help.

Hemotem

Avatar
ChickenMobile
2,460 Posts
Posted Apr 10, 2012
Replied 3 hours later
If you didn't know: path_tracks have an alternate branch path option where you can enable and disable it based of inputs.
Avatar
hemotem
21 Posts
Posted Apr 10, 2012
Replied 43 minutes later
Yes I even tried that a few times to get the result I wanted. but alas it did not work either.
A simplified design I wanted to use 8 points if I could get this right.

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;O3
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|r
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|e
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|a
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|l&nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|y
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; relay3&nbsp; &nbsp; &nbsp;|2&nbsp; &nbsp; &nbsp;relay1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;O4-------------O1-------------O2
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;r |
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e |
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;l |&nbsp; logic_case1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a |
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;y |&nbsp; logic_timer1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 |
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;O5
O1 thru O5 are the path_tracks

Logic_timer set to random time tied to the logic_case to fire the case. relay1 - relay4 set to on trigger MoveToPathNode track2 to track5, track2 to track5 are stet to next stop track1, since that did not work I ended up putting in MoveToPathNode track1 in track2 to track5 and it went to track5 and back to track1 repeatedly sometimes with a delay or an early switch in the movement from track1 to track5 and back.

That is the design I was looking for. but have hit a brick wall so to speak.
So anyone have an idea what I am doing wrong here?

Avatar
Robdon
204 Posts
Posted Apr 10, 2012
Replied 2 hours later
Hi,

See attached map...

Is this what you what it to do?

As far as I know, you need to have all the paths connected in a serial 'line' (just like a real trains tracks), so you cant just jump around so easily.

You need some 'fake' paths to teleport to before moving to the correct path.

Also needed is a 'fake' end path. This is because there is a slight bug with paths in that the 'end' path is always slightly offset compared to all the others, so a fake end needs to be there, but its never used really.

Not sure if there is an easier way, but that was how I've done it.

Rob.

Attachments
Track.vmf
0.02 MB 37 downloads
Avatar
hemotem
21 Posts
Posted Apr 10, 2012
Replied 1 hour later
YES!!! and it works with what I was attempting thank you thank you thank you and THANK YOU!! Now if there is a way to get rid of the extra tracks and stick with just the 5....6 for the fake end path it will make it faster to build in the future. but I am so happy four days trying to figure this out and I am sooooooooo happy =) now to see how it looks when actually put to use. =)sorry for the hyperness of this post I am working on my 53rd hour of insomnia.

EDIT:
Went and made the tracks longer found an issue of the train jumping to the middle but figured it was the time that was placed in the tracks01_05 increasing that solved the problem =)

Advertisement
Registered users don’t see ads! Register now!
Avatar
Robdon
204 Posts
Posted Apr 10, 2012
Replied 3 hours later
Yeah, I just made the timer wait 2 seconds and then refire.

If you want to make it more stable, then get rid of the timer, and then put outputs on the path_01_02 - path_01_05 paths for 'OnPass' and make them do the logic_case random selection there.

Then it doesnt matter how long you make them, they will automatically trigger the next one when they get to the each path.

Rob.