• How to make cart choose a path randomly
    9 replies, posted
How does one do it?
An io system would be your best bet, but i have no idea about what your needs are. Could you be more specific?
There's track, and then the track splits into two, and it needs to randomly pick which route to take.
Path_track_branch I believe.
[QUOTE=Firegod522;24846608]Path_track_branch I believe.[/QUOTE] There wasn't such a thing as path_track_branch
Okay well I was thinking of the altpath keyvalue :gonk: just use a logic timer to fire the input for it.
Here's how I would do it: You can generate a random number from 0-1 with a math_counter, but I've never used it so I don't know the ins and outs, should be fairly straightforward. A logic_case can pick 1 of 16 outputs based on an integer value that you give it. You should assign "case 1" to the value "1", then set its "onCase01" output to choose the alternate path of your track. Then, to make it all work you want to generate your 0 or 1 with the math_counter, then send the counter's OnGetValue output to the logic_case's InValue input. This both gives the logic_case the random number and tells the logic_case to fire the appropriate output. If the number was 1, it will reroute the cart to the alternate path. If it was 0, it won't do anything and will leave the cart on the first path.
Pretty much what splitsticks said, but I don't think you need the math_counter. All you need is a trigger brush ( trigger_once I believe? ) that when triggered tells a logic_case to PickRandom ( PickRandom being Case 01 or Case 02 ) and on Case 01 it would remain on the original path, where as on Case 02 it would take the other path. Well, this is how I make my entities pick a sequence at random :v:
The simpliest way would be a logic_timer with a random time (or a non-random time) and the output OnTimer | {nameofpath} | ToggleAlternatePath Edit: Nevermind, someone already posted that. Sorry.
The [url="http://developer.valvesoftware.com/wiki/Logic_case"]logic_case entity[/url] is far more effective for random functions. You can set it up to use two cases and enable/disable your branch path respectively.
Sorry, you need to Log In to post a reply to this thread.