Spawn actors at random intervals

dre38wdre38w Member Posts: 79
edited November -1 in Working with GS (Mac)
I'm trying to spawn actors at random intervals, as the topic title implies. How would I go about that? I tried using every random seconds spawn but that doesn't randomize the seconds at all. Tried using an Attribute and randomize that every set seconds and then use that randomizing Attribute as the random interval to spawn by. Didn't seem to work either. I'm at a loss. Any help is much appreciated.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Try something like this.
    First Create a game attribute called spawn
    Then two rules Rules

    When game.spawn = 0
    --Spawn Actor
    --Timer After Random(1,5)
    ----ChangeAttribute game.spawn to (game.spawn+1)%2
    Otherwise
    When game.spawn = 1
    --Spawn Actor
    --Timer After Random(1,5)
    ----ChangeAttribute game.spawn to (game.spawn+1)%2

    That should give you a constant random spawn every 1 to 5 seconds.

    I haven't tested it but I think that should be right.

    Edit: TSB beat me to a response I guess. Let us know if either worked.

    ___________________________________________________________________________________
    Project Help from Tenrdrmer Click Here

    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    Menu #4 - Level Banners HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • dre38wdre38w Member Posts: 79
    Thank you, thank you. I'll try it as soon as I get home.
  • dre38wdre38w Member Posts: 79
    Thank you tenrdrmer! That worked perfectly! Although I have some confusion. I originally had several random actors spawning at random times just all at the same rate. So I wanted to spawn them at a random rate. So I'm trying to see how your method would work for that. Also, just wondering, can the numbers go lower than 1?
  • dre38wdre38w Member Posts: 79
    Sorry to up the post again but just wondering if anyone has an idea at all. Thank you.
Sign In or Register to comment.