How to constantly changing a random number

Hi communities!
Recently i am developing a function which will spawn enemy "every a random time". I set a timer in "every" and than use the function Random(min,max) to define the time.
It sounds easy but i found out some problem.
The random number only do once! Say, if it random a number 6, the enemy spawn every 6 second, which is not what i want. I want the random number to be constantly changing. What i want is the enemies will spawn in a constantly changing time.
What did i do wrong in my logic? Any opinions? Thanks for help!

Best Answer

Answers

  • zzzz02zzzz02 Member, PRO Posts: 20

    after the random function in your timer you have to add the minimum and maximum time. So if i wanted an actor spawn every 3-5 seconds, my rule would be

    Timer
    Every random(3,5) seconds

    spawn actor (enemy)

  • greedydadygreedydady Member Posts: 35

    Yes that is exactly what i doing. I have put the numbers in it. And as i said, after it random a number between say (3,9), its 6. The number fixed to be 6 and the spawner constantly spawn enemies every 6 sec. Which i dont want happen like that, I want a constantly changed random number in that timer. And make all enemies spawn in different duration.

  • greedydadygreedydady Member Posts: 35

    this is really really helpful! thanks a lot, save my life

  • zzzz02zzzz02 Member, PRO Posts: 20

    Well as long as the "every" tab was selected, it would choose a random number directly after the last.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @zzzz02, it does not work that way. The timer gets its value at the start and sticks to it for every repetition.

Sign In or Register to comment.