Pick a random activated tag
Hi!
I have 24 identically named tags, but not all are active at once. Is there a way I can get it to pick one of the active ones at random?
I felt like splitting the Number Detected field in a trigger zone would help, but that didn't give me anything I could use.
Thanks!
-
Think I've figured out a very makeshift solution. If it works I'll share it.
-
Yes, it did do what I needed.
Let me see if I can explain it, in case it's useful to anyone.
A microchip with 3 randomisers, each connected to 8 value sliders set 1 through 24. A timer (which resets itself) set to 0.1 seconds controls a 4th randomiser that is linked to each of the three others. Each value slider is attached to the power port and value of a variable modifier set to 'set'.
On the item(s) with the tag I have another microchip with a value slider, each one unique and acts as an identifier for that tag. That's fed into port A of a calculator set to = and a variable named the same as the modifier is attached to port B. The result of that leads to a keyframe that turns off the timer and also to anything I want the selected tag to control. The tag itself turns this microchip on and off depending on whether or not it is detected.
So basically the timer rapidly powers on the randomiser choosing numbers between 1-24. The first active tag that matches one of those numbers turns off the timer, stopping any other tags from being selected.
Happy to publish the logic in Dreams if anyone wants. -
A more simple way to create a random number would be to use a Signal Generator,
If you set the time to 0 the output is a random value between the minimum & maximum that you set,
You probably need to put the Sig Gen in to a calculator to round it to a whole number. -
I did try that method, but the problem with that is it always starts by travelling through 1 before cycling through the range, so the tag linked to that number was chosen first every time.
-
You could skip the first frame, using a timeline. https://youtu.be/VXNk4rUzxmI?t=509
I do that all the time for randomising sig-gen. -
Thanks, I'll have a look at that later! I knew there must be a simpler way.
Please sign in to leave a comment.