Is it possible to change behavior of a random actor?
gooner
Lancaster, PAMember Posts: 135
1) Spawn 10 actors from the same prototype.
2) All 10 are on the screen not moving.
3) I would like one of them (randomly chosen) to move to the right.
So, how can I choose one of the spawned actors randomly, and then access/find it to change it's behavior.
I was thinking I would need to give each actor a name attribute and save those names in a table. The table would let me choose one randomly from the name column, then I could use the actor name to change it's behavior. Not sure this would even work or if I am on the right track, figured I'd ask the fine folks on the forum.
Any advice or links to existing threads would be much appreciated (not sure how to describe this, so i didn't have luck finding exactly what I need to do).
Thanks!
Comments
Just count the actors as they're spawned and assign the corresponding number to the actor. Then just change a game attribute to random(1,count) and put logic in each actor to say "move when game.attribute = self.number".
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
trying that out later, thank you!