Spawning a Random Amount of Actors

ADSentertainmentADSentertainment Member Posts: 397
edited June 2013 in Working with GS (Mac)
Is it at all possible to easily make it so an actor can spawn a random amount of other actors? There's no "Number of Actors" text box in the Spawn Actor behavior, so I couldn't use a random function or anything. Is there something I can do with tables, perhaps? (I have a slight knowledge of tables, but nothing too broad)

Having trouble with your game? Sounds like a personal problem.

Comments

  • ironDanironDan Member Posts: 148
    Sure, create two Self.Attributes (Integer) 1st is the Number of Actors to Be spawned and the 2nd set to zero. Then in a Timer Behavior or a Self.Time Attribute add a Rule that says If 2nd Self.Attribute is < 1st Self.Attribute Every # of Seconds change 2nd Self.Attribute to 2nd Self.Attribute+1. By doing that when the 2nd Self.Attribute = the 1st Self.Attribute the Spawning of actors will stop.

    Dan
  • ADSentertainmentADSentertainment Member Posts: 397
    Sure, create two Self.Attributes (Integer) 1st is the Number of Actors to Be spawned and the 2nd set to zero. Then in a Timer Behavior or a Self.Time Attribute add a Rule that says If 2nd Self.Attribute is < 1st Self.Attribute Every # of Seconds change 2nd Self.Attribute to 2nd Self.Attribute+1. By doing that when the 2nd Self.Attribute = the 1st Self.Attribute the Spawning of actors will stop.

    Dan
    Would that do it all at once though? That sounds like it would keep spawning actors until the second attribute would be equal to the first attribute

    Having trouble with your game? Sounds like a personal problem.

  • SocksSocks London, UK.Member Posts: 12,822
    I alway thought the spawn behaviour was missing an iteration field, it would be enormously useful
  • ironDanironDan Member Posts: 148
    Oh, yeah no prob I just re-read and realized you wanted it random. Sure, Create another Self.Attribute (Integer) Call it Random, then in a Rule (Whatever Rule is going to set off the Spawning) put Change Attribute Self.Random to Random (1,??) Then Below that add the Timer and the prior Rules from above.

    Dan
  • ADSentertainmentADSentertainment Member Posts: 397
    I alway thought the spawn behaviour was missing an iteration field, it would be enormously useful
    Indeed it would

    Having trouble with your game? Sounds like a personal problem.

Sign In or Register to comment.