Jump to content

Is this the most efficient 10 way switch to randomly select mission objectives?


Recommended Posts

Posted

I'm creating a single player patrol mission where one of ten scenarios is randomly selected. I created a switch that allows me to scale the switch and add more options, while also letting me increase tendency towards specific options by tweaking the random probabilities of each timer. It's pretty simple, timers go from left to right with a delay of 1 sec between each. The first mission objective timer has a 1/10 chance of firing and outputs to the group containing the mission objective, while also triggering the deactivation of every other timer in the chain. If the first timer does not activate, the second one gets a 1/9 chance to fire, and so on. I added a 500ms delay timer between activating the mission objective and deactivating the other timers, because not having redundant timers gives me anxiety

10wayswitch.PNG

No_85_Gramps
Posted

I'm no expert but that looks good to me!

Posted (edited)

I believe... you're missing the individual deactivations for each output. As an example, output 1 should deactivate 2-10. Output 2, should deactivate 1, and 3-10. And so on. See @JimTM's Four-way randomizer as an example:

 

image.thumb.png.d623c3bc26aa80ad2c9a08be96f88eaf.png

This is what the four-way randomizer looks like.

 

image.thumb.png.b4b93105a29579b1bfd26a9c9cb0ae53.png

The highlighted are the individual deactivators per selected output.

 

You can get the four-way randomizer and expand upon it here: 

 

Edited by Sketch
  • Upvote 1
Posted

I have a single Deactivate that turns off timers 2-10, which i think works like you are describing. Each of my random timers is connected to the deactivate, so the first time one of them fires, it should deactivate all remaining timers. When I scaled down this design to 3 options and tested it, only one objective was spawning in, and they seemed random, so I think it works. I may be able to just have every random timer output to a single 500ms delay timer, which then targets the mass deactivate.

  • Like 1
AEthelraedUnraed
Posted

If you want maximum efficiency, you can remove the bottom row of "cancel" timers. Just link each of the top row of random timers to the Deactivate MCU. No need for anxiety :) If you want it to work a little faster (one interpretation of "efficiency"), you should be able to change the timer delays from 1s to 50ms.

 

As I'm sure you're aware, this is only a one-time switch. If you ever plan to use it again in a mission, you're gonna need some extra logic to reset it.

 

Of course, one could argue if it's necessary to have any "efficiency" at all; I don't think timers have much influence on CPU usage, if at all. Especially if it's a one-off timer run at mission start as shown here.

  • Upvote 1
  • 5 weeks later...
Posted

That's fine, I plan on calling this type of switch for selecting mission objectives and spawn variants of somewhat scripted missions, which are one time events

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...