Destroying old spawned actors
Lonestar
Member Posts: 28
Once again i need a little help
Right now i have a dialog box system where the user clicks through read the individual text (much like a RPG).
This is how it was done
http://gamesalad.com/forums/topic.php?id=4084#post-24253
I also set it up to spawn actors with it in each click.
The problem is i the old actors that it spawns wont go away once the new text is clicked. The text goes away but the new spawned actor doesn't. Most of the solutions that i have read involves destroying an actor buy button pressing it, but since it is a spawned actor separate from the "dialog" actor this solution does not work.
Im looking for a way to destroy the old actors that it spawns, any ideas?
Right now i have a dialog box system where the user clicks through read the individual text (much like a RPG).
This is how it was done
http://gamesalad.com/forums/topic.php?id=4084#post-24253
I also set it up to spawn actors with it in each click.
The problem is i the old actors that it spawns wont go away once the new text is clicked. The text goes away but the new spawned actor doesn't. Most of the solutions that i have read involves destroying an actor buy button pressing it, but since it is a spawned actor separate from the "dialog" actor this solution does not work.
Im looking for a way to destroy the old actors that it spawns, any ideas?
Comments
And keep a global game integer Attribute called CurrentNumber.
This global attribute would increment each time a new actor is spawned.
Have a Rule in each Actor that says:
When game.currentNumber > self.myNumber
Destroy
I just tested it out but, it partially works.
I had to make some minor changes to what you said though.
I had to add a change attribute in the actor code saying
game.currentNumber+1
What you suggested to me didn't have a way to add the current number.
What happens now the actor is spawned for a brief mili second and then is destroyed.
What i tested next was to try having the CurrentNumber start out at a value 2 less that the myNumber value . What happened was the actor spawned once then on the second click all of the spawns disappeared together.
The "When game.currentNumber > self.myNumber" idea works great but the problem now is that i destroys all instances of the actor.