Is there any way to make a Spawner spawn actors randomly between a set few positions?

FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

So I want a spawner to spawn an actor every 5 seconds from one position, or another position, or another. 3 different places total, and just randomize between the three places every 5 seconds. How would I do this? There's no way to set up multiple "or" positions in the spawner attribute.

Comments

  • I_AM_BENJII_AM_BENJI USAMember Posts: 40

    make an attribute call it something like 'choose place'

    set up a Timer
    every .1seconds change attribute choose place to random(1,3)

    rule:
    if choose place is = 1
    spawn actor at (x, y)

    rule:
    if choose place is = 2
    spawn actor at (x, y)

    rule:
    if choose place is = 3
    spawn actor at (x, y)

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148
    edited January 2015

    It's not working, its not spawning anything for some reason.... hmmm.

    (on the spawner actor)

    **Group: [[Timer: Every 1 seconds
    Change Attribute: game.Choose Place to random(1,3)]]

    Group: [[Timer: Every 3 seconds
    Rule: if Choose Place = 1
    Spawn Actor "Dart A" from position (coords x&y)

                      Rule: if Choose Place = 2
                              Spawn Actor "Dart A" from position (coords x&y)
    
                      Rule: if Choose Place = 3
                              Spawn Actor "Dart A" from position (coords x&y)]]**
    
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I have a demo that shows how to spawn actors to specific positions based on table data: http://forums.gamesalad.com/discussion/comment/383521/#Comment_383521.

    You would just choose a random row and spawn an actor based on the table cell values for that position (x & y).

    And I just made this demo to address a possible problem with your rules above. Choosing a random number works as long as the value doesn't repeat the previous value. This demo resolves that issue: http://forums.gamesalad.com/discussion/comment/513319/#Comment_513319.

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

Sign In or Register to comment.