Random Animation - Easy method

3

Stats

9,880 visits, 14,227 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 4 May, 2014. Last updated 19 Feb, 2019

People sometimes want to use a random animation but want more options.

Firstly, props to Weishaupt, who wrote another very good tutorial here that explains a longer method of doing this, and I learned from it - you should check it out. Though eventually I found an even easier way to do this without any variables, random number generation or even math.

The magic command: choose

The "choose" command is just the word "choose" and then 2 or more parameters. Incredibly handy.

In this example:

choose("red","orange","yellow","green","blue","violet")

the command will randomly pick one of the colors and return that text. You might get back the word "red" or the word "blue" or any of the other items you put in the list of parameters.

We simply combine this "choose" command with the Set Animation action. That is, when you want the new animation randomly chosen, just list which animations you want randomly selected from using the choose command like so:

Just substitute your animation's names. Use only the animations you want randomly chosen by putting them in the list.

Tweaks

Another thing you can do is give more weight to animations you want to see more often. So for example, if you want to see the animation named "Default" more often, then put it in the list twice (or more) like so:

The order of the animations in the choose list does not matter, a new one will be selected at random whenever your condition triggers.

++++++++

from the Manual

choose(a, b [, c...])

Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two.

  • 5 Comments

  • Order by
Want to leave a comment? Login or Register an account!