Tables, and spawning - need help

IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
edited July 2012 in Working with GS (Mac)
Hi!
I have 6 different actors - I want them to spawn inside a level, based on the numbers inside a table.
I have a table called "Elements", it contains 10 columns - one for each level, and 6 rows - one for each actor.
All of values are Integers, and numbers inside each cell are numbers - how many actors of this type I want inside each level.

So it looks like this:

Level1
Actor1 0
Actor2 2
Actor3 1
Actor4 0
Actor5 5
Actor6 1

So inside the first level I want 0 Actor1, 2 Actors2, etc. Now how to make a rule which would spawn the right number of each actor inside scene?

Just to be clear - I make all levels inside one scene, so this is why I use tables.

Thank you!

Best Answer

Answers

  • simo103simo103 Member, PRO Posts: 1,331
    edited December 2016
    @IsabelleK .. I would use 2 timers with the spawn in them. So for example I would run the timer for 1 sec and the second timer every 0.2 sec I would have the spawn which would give me 5 actors. Run it for 0.8 secs every 0.2 secs to get 4 actors etc. Does that help?
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    @simo103 thank you for your answer, but I'm looking for some more automatic rule - which would spawn the right number of actors, even if I change the value inside the table.
    It doesn't have to be Spawn behavior, it can be any way, to make actors appear, based on the numbers in tables.
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    I managed to do it :)

    If anyone needs something like this, here it is:
    I have a new actor - I called it Spawner. It has 6 integer attributes inside him (each for each row in a table). At the beginning of the scene it changes each of these attributes to the appropriate value from a table.
    Then there's a rule (for each attribute):
    If self.1 is bigger than 0
    Timer, every 1 sec
    Spawn actor 1
    Change attribute self.1 to self.1-1

    :)
  • J_PANJ_PAN Member Posts: 140
    ok awesome
Sign In or Register to comment.