help me with random timer please

OxygenOxygen Member Posts: 14
edited November -1 in Working with GS (Mac)
hello !!

Sorry to ask but even with the "how to" tutorial, i can't make my random timer works...

here is the problem :
- in my game, all the time, some actors have to spawn randomly (every random 4 and 10 seconds).

I try everything, with rules, without rules, with attribute in actors... and nothing works.

help me please thanks

Comments

  • AppsRacKAppsRacK Member Posts: 346
    try this.

    1. create a integer attribute name it "randomizer" or what ever you want & a Boolean attribute name it "spawned" or whatever you want.
    2. on your spawner place a rule when "spawned is false>>>change attribute>>randomizer = random (1,5); then put "change attribute spawned = true";

    3. then place another rule again "when randomizer = 1 & spawned = true >> timer (after 4) >> spawn (your actor) then put "change attribute spawned = false "
    4. do the rest with the other value of randomizer then change the time as well.

    I havent check this one out as i type it in PC so let me know how it goes.
  • OxygenOxygen Member Posts: 14
    ok, if i understand i have to put a rule for every second I want the spawn !!!
    So if i want a randow between 4 and 10 second i have 7 rules !!! awesome ! :s
  • OxygenOxygen Member Posts: 14
    I try something and it works fine !!!
    on my spawner i put 2 attribute, timer as an integer and reseed as boolean then
    IF self.reseed is true
    THEN change self.timer to random(4,10)
    after self.timer
    spawn
    change self.reseed to false
    OTHERWISE
    change self.timer to true
  • AppsRacKAppsRacK Member Posts: 346
    cool. much better. nice to hear it worked.
Sign In or Register to comment.