Jump to content
Sign in to follow this  
Melmarkian

Something like else in fsm

Recommended Posts

Hi,

I am playing around in the FSM-Editor at the moment and want to set up a test with a random number.

One problem:

When one condition is selected I want to exclude it in the next check. No problem to do if i set a second condition. But now it can happen that the no condition is met. Is there a simple way to loop the check until one of the conditions is true? Like

round(random 1)

if 0 & ZeroNotAlready

if 1 & TwoNotAlready

else do randomcheck again

Share this post


Link to post
Share on other sites

Someone smarter will probably come and tell a simple condition checking solution, but you could use something like this. Instead of using a condition to check that the option is not used yet, you simply remove it from the available options once it's picked.

_options = [0,1];
_random = floor random count _options;
_option = _options select _random;
_options = _options - [_option];

Share this post


Link to post
Share on other sites

thank you!

I came to the same result. The only difference is I used bis_fnc_selectrandom to pick a array element.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×