Random spawn point no repeat (dealing with removing and adding rows)

MegaemmanMegaemman Member, PRO Posts: 72
Hello in my game i have these rules set up for my spawn actor:
https://www.dropbox.com/s/nh9hj6qhhaj4re6/Screenshot 2014-02-04 10.14.11.png

I have different actors spawning every two seconds in eight different locations( eight row with different x,y locations) at random during a 60 second time period. Unfortunately , some of the actors will spawn in the same location.

I wanted to make so the actors don't overlap so i followed the Random spawn point no repeat template :
https://www.dropbox.com/s/gjlzokyn6rci4sa/Screenshot 2014-02-04 10.16.37.png

I was wondering once you remove the rows can you add them back after a short period of time, or would it be easier to add more rows instead?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'm not sure why your actors are spawning in the same location. Perhaps the every 0 seconds timer is too fast for the table to delete the row properly, but I'm not sure about that.

    I don't really understand what you're asking here:
    I was wondering once you remove the rows can you add them back after a short period of time, or would it be easier to add more rows instead?
    Add more after a short time or add more...? What's the difference?

    Usually, if you are choosing a random value from a table, you would do so until the table is exhausted (empty). If you need to use those values again, you could copy the table before it gets used and then copy that backup into your active table and start the process again.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MegaemmanMegaemman Member, PRO Posts: 72
    edited February 2014
    @tatiang
    Usually, if you are choosing a random value from a table, you would do so until the table is exhausted (empty). If you need to use those values again, you could copy the table before it gets used and then copy that backup into your active table and start the process again.
    Basically i would like to recycle those values again with out having the actors overlap, so in order to do that i would have to create a master table? So every blah blah seconds once the first table before exhausted i would use this attribute:
    https://www.dropbox.com/s/shjxvxzhzlm88h2/Screenshot 2014-02-04 18.58.07.png

    Sort of like a loop hmmm... I'll give it a go!

    UPDATE: Tested it out and now the overlaps are near to none, thanks !


  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    That's called a behavior, but yes, you would copy the master table back into the working table. You would use a timer for your actor spawning and then most likely have a rule that says When attribute game.zero = tableRowCount(tableName) --> copy the master table.

    Create an integer attribute called game.zero and give it the value 0.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.