Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: losaposta on October 15, 2016, 06:36:53 AM

Title: random 5 of 25 fields are true with random animation or object ?
Post by: losaposta on October 15, 2016, 06:36:53 AM
i need to populate 5 of 25 fields  and when i click on field and if it is true it should play 1 of 5 animations  or populate with 1 of 5 object

(http://i.imgur.com/ihJqmwV.jpg)

thing I have now is  random bool  for field and when it is greate than 5 is should not have possibility to make true bool
but very often it makes more that five
(http://i.imgur.com/JcxSnd4.jpg)
Any thoughts ?
Title: Re: random 5 of 25 fields are true with random animation or object ?
Post by: djaydino on October 16, 2016, 10:03:45 AM
Hi,
From what i can see, you have this fsm on all 25 fields, If so what is happening is
that all fsm's are doing this at the same time.

You might want to set this up differently.

you can use an array and add your 25 fields in it, then you need a custom action from the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) called 'iterate' to loop 5 times.
In the loop you get a random field from the array with "Array Get Random" then place it in a different array, call it 'ActiveObjects' for example.
and loop 5 times.

after the loop add the "mouse down" Action and on the next state have a mouse pick and store your game object, then use "Array Contains" on the 'ActiveObjects' to see if its one of the 5 objects, if it is you can use a random event to do a random animation.

Here (https://hutonggames.fogbugz.com/default.asp?W548) you can find tutorials for these actions.
Title: Re: random 5 of 25 fields are true with random animation or object ?
Post by: losaposta on October 19, 2016, 09:10:57 AM
Thanks a bunch