Destroying old spawned actors

LonestarLonestar Member Posts: 28
edited November -1 in Working with GS (Mac)
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?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    each actor could have an integer Attribute called something like myNumber.

    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
  • LonestarLonestar Member Posts: 28
    Brilliant idea!
    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.
Sign In or Register to comment.