How do I choose a random number without choosing the same one again?
AleksandrGames
Member Posts: 54
So what I want is to be able to spawn 1 out of 26 different actors ever 20 seconds, but I don't want it to choose to spawn the same actor again as long as you are in that scene. How can I do this? I tried putting a timer for every 20 seconds and put Change Attribute "spawn actor" to random(1,26). and a rule with If "spawn actor" = 1, spawn actor 1. So if it picks 1 then it should spawn it, but how do I prevent it from picking 1 again after it's been picked for that scene? Or maybe i'm completely off and there is a different and better way to go about this, in which case how should I do this?
Thanks
Comments
Perhaps this YouTube video from GSHelper could help you.
I tried to do something to show you and then I ran into problems using loops within timers so this thread was born.
http://forums.gamesalad.com/discussion/88128/am-i-doing-something-completely-wrong-or-is-there-a-bug-in-gs-loops#latest
But then textFind was suggested and it turns out I don't need to use a timer or loops to find a random unselected actor.
Attached are files that might help you using this flags method that records the fact that actors are unselected/selected using 0's and 1's inside a text string.