Speed up spawning based on score
Hi, first post, first problem. 
Here's my setup:
I got an integer called "spawnSpeed" with a default set to 8.
I got a spawner which spawns actors "every spawnSpeed seconds".
Then I got a scoreCounter.
Every time the score doubles, I divide the spawnSpeed by 2 and set the new value.
This appears to work: I have a text box display the spawnSpeed, and it divides the speed nicely every time the score doubles. So I can *see* it change from 8 to 4, 2, 1.
But: The spawner continues to spawn at the original value (8) no matter what I try. I even tried saving a key and having the spawner load that key every 0.5 seconds, but all to no avail.
So, any pointers appreciated, I feel as if I_m missing something rather obvious.
Thanks
Marcus

Here's my setup:
I got an integer called "spawnSpeed" with a default set to 8.
I got a spawner which spawns actors "every spawnSpeed seconds".
Then I got a scoreCounter.
Every time the score doubles, I divide the spawnSpeed by 2 and set the new value.
This appears to work: I have a text box display the spawnSpeed, and it divides the speed nicely every time the score doubles. So I can *see* it change from 8 to 4, 2, 1.
But: The spawner continues to spawn at the original value (8) no matter what I try. I even tried saving a key and having the spawner load that key every 0.5 seconds, but all to no avail.
So, any pointers appreciated, I feel as if I_m missing something rather obvious.
Thanks
Marcus
Comments
Given the possibility that I am correct I think you will have to put a boolean self attribute in that a rule checks to see if it is true to spawn, a rule with a timer to close the boolean to false, then use different rules with timers in set up at different rates, or a counter that is incremented by a timer and then choose how you divide the rising total, and fire off that.
edit- I have just found a way to make it work and update the timer. This may be well known...
2 actor self attributes- boolean for spawn, speed as an integer.
and 2 rules-
rule 1- when self spawn is true... spawn actor and a timer- after 0.1 (run to completion) change attribute self spawn to false
rule 2- when self spawn is false- timer every 'self speed' (run to completion) change attribute self spawn to true
Just for reference, I didn't use a "self spawnSpeed" attribute, but rather went with "game spawnSpeed", as I'm updating this via different actors.