Spawning Rate Issues

BlueFanStudiosBlueFanStudios Member Posts: 77
edited November -1 in Working with GS (Mac)
I am having a small issue with spawning objects. Basically, using a real attribute called spawnRate, I have a timer going that spawns 1 of 25 random objects every 0.7 seconds. Everytime a particular event occurs, I want that amount of time to decrease by 0.05. I thought this would be as simple as change attribute with the values game.spawnRate to game.spawnRate - 0.05.

The problem is that while that value of spawnRate does decrease, the objects do not actually spawn at a faster rate.

Any ideas will be greatly appreciated.

Comments

  • BlueFanStudiosBlueFanStudios Member Posts: 77
    Le Bump*
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    It is quite complicated actually. I have a demo that shows how to do it.

    Go into GS creator and look in the new section for "Timer with Variable Rate". You'll need to copy that into your project exactly as it is in the demo. You'll need to recreate the attributes in your project. Be sure to check the "otherwise" sections in the spawner rules.

    If you have deep blue designs project merger use that. If you don't have it GET IT! :)
  • MotherHooseMotherHoose Member Posts: 2,456
    no it wont decrease... while it is running

    create a boolean gameAttribute called something like Spawn
    and a real gameAttribute spawnRate

    on your trigger actor Rule
    touch is pressed
    spawnRate > 0
    changeAttribute game.Spawn To: false
    changeAttribute game.spawnRate To: game.spawnRate-0.05
    Timer After 0.01 seconds changeAttribute game.Spawn To: true

    on your Spawner actor
    enclose the Timer in a Rule when game.Spawn is true
    Every expression: game.spawnRate seconds

    and do NOT check Run to Completion... as that will not allow for changes as long as the Spawn is true

    ---
    think when you tell the computer to do something in programming Every... it does so regardless of trigger events initiated by user input... unless a condition is controlling the Every.

    MH
Sign In or Register to comment.