Spawn random actors without repeat
jerlant360
Member Posts: 82
Hi guys , i have a spawner who spawn 3 falling actor at certain time , the issue is that the 3 actors spawned are always the same one , how can i make it spawn without repeat an actor?
Thanks
Thanks
Comments
Have the rules say, if 1, spawn here, if 2, spawn here, and so on.
This will keep it sort of random.
Then, in your spawner actor do this:
When [condition or timer]
Change Attribute self.Random (type: index) to random(1,TableRowCount(TableName))
When self.Random=1
[spawn actor 1]
When self.Random=2
[spawn actor 2]
etc.
Delete Table Row at index self.Random
If you then repeat this entire rule via a condition or a timer or a loop, it will choose a random row of the table to pull a number from and then delete that row from the table so that it isn't re-used.
Keep in mind that you'd want to stop spawning actors when the TableRowCount reaches zero.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User